From f1366b39891402b0db9de661ad181089bfd79053 Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Fri, 23 Nov 2007 11:16:46 -0800 Subject: got log and cat-file moved to pure ruby --- tests/units/test_raw_internals.rb | 41 ++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'tests') 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 -- cgit