summaryrefslogtreecommitdiffstats
path: root/tests/units/test_raw_internals.rb
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.(none)>2007-11-23 11:16:46 -0800
committerscott Chacon <schacon@agadorsparticus.(none)>2007-11-23 11:16:46 -0800
commitf1366b39891402b0db9de661ad181089bfd79053 (patch)
treed6ef49a6bda5b7327d6d6a66edfb9c8bdb5a97cc /tests/units/test_raw_internals.rb
parent90dea6d415bfc5734bc87c2797b26cca311246bc (diff)
downloadthird_party-ruby-git-f1366b39891402b0db9de661ad181089bfd79053.zip
third_party-ruby-git-f1366b39891402b0db9de661ad181089bfd79053.tar.gz
third_party-ruby-git-f1366b39891402b0db9de661ad181089bfd79053.tar.xz
got log and cat-file moved to pure ruby
Diffstat (limited to 'tests/units/test_raw_internals.rb')
-rw-r--r--tests/units/test_raw_internals.rb41
1 files changed, 23 insertions, 18 deletions
diff --git a/tests/units/test_raw_internals.rb b/tests/units/test_raw_internals.rb
index 4299a2b..1437845 100644
--- a/tests/units/test_raw_internals.rb
+++ b/tests/units/test_raw_internals.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-
+require 'logger'
require File.dirname(__FILE__) + '/../test_helper'
class TestRawInternals < Test::Unit::TestCase
@@ -10,26 +10,31 @@ class TestRawInternals < Test::Unit::TestCase
def test_raw_log
g = Git.bare(@wbare)
- #g.repack
+ t_log(g)
+ end
+
+ def test_packed_log
+ g = Git.bare(@wbare)
+ g.repack
+ t_log(g)
+ end
+
+ def test_commit_object
+ g = Git.bare(@wbare, :log => Logger.new(STDOUT))
- c = g.object("HEAD")
- puts sha = c.sha
+ c = g.gcommit("v2.5")
+ assert_equal('test', c.message)
+ end
+
+ def t_log(g)
+ c = g.object("v2.5")
+ sha = c.sha
repo = Git::Raw::Repository.new(@wbare)
- while sha do
- o = repo.get_raw_object_by_sha1(sha)
- c = Git::Raw::Object.from_raw(o)
-
- sha = c.parent.first
- puts sha
- end
-
- g.log(60).each do |c|
- puts c.sha
- end
-
- puts c.inspect
+ raw_out = repo.log(sha)
+ assert_equal('commit 546bec6f8872efa41d5d97a369f669165ecda0de', raw_out.split("\n").first)
+ assert_equal('546bec6f8872efa41d5d97a369f669165ecda0de', c.log(30).first.sha)
end
-
+
end \ No newline at end of file