fixed issue with running a 'git log' with an object that won't rev-parse (file)
[rubygit.git] / tests / units / test_raw_internals.rb
blobb37a66dc3e2a191fa70f5cc78a2b0644f5e56182
1 #!/usr/bin/env ruby
2 require 'logger'
3 require File.dirname(__FILE__) + '/../test_helper'
5 class TestRawInternals < Test::Unit::TestCase
6   
7   def setup
8     set_file_paths
9   end
10   
11   def test_raw_log
12     with_temp_bare do |g|
13       t_log(g)
14     end
15   end
16   
17   def test_packed_log
18     with_temp_bare do |g|
19       g.repack
20       t_log(g)
21     end
22   end
23   
24   def test_commit_object
25     g = Git.bare(@wbare)    
26     c = g.gcommit("v2.5")
27     assert_equal('test', c.message)
28   end
29   
30   def test_lstree
31     g = Git.bare(@wbare)
32     c = g.object("v2.5").gtree
33     sha = c.sha
34     
35     repo = Git::Raw::Repository.new(@wbare)
36     assert_equal('ex_dir', repo.object(sha).entry.first.name)
37   end
38   
39   def t_log(g)
40     c = g.object("v2.5")
41     sha = c.sha
42     
43     repo = Git::Raw::Repository.new(g.repo.path)
44     raw_out = repo.log(sha)
45     
46     assert_equal('commit 546bec6f8872efa41d5d97a369f669165ecda0de', raw_out.split("\n").first)
47     assert_equal('546bec6f8872efa41d5d97a369f669165ecda0de', c.log(30).first.sha)
48   end
49   
50   
52   
53 end