From 07ebb951368ed31bdaebc2e820c62ced22c8bbe4 Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Tue, 27 Nov 2007 08:06:51 -0800 Subject: added Matthias and Simon to credits for the gitrb code fixed an issue with raw object tree formatting added ls_tree implementation in raw git --- lib/git/lib.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/git/lib.rb') diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 120d9ce..decd6d4 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -183,16 +183,22 @@ module Git def object_contents(sha) #command('cat-file', ['-p', sha]) - get_raw_repo.cat_file(revparse(sha)) + get_raw_repo.cat_file(revparse(sha)).chomp end def ls_tree(sha) data = {'blob' => {}, 'tree' => {}} - command_lines('ls-tree', sha.to_s).each do |line| - (info, filenm) = line.split("\t") - (mode, type, sha) = info.split - data[type][filenm] = {:mode => mode, :sha => sha} + + get_raw_repo.object(revparse(sha)).entry.each do |e| + data[e.format_type][e.name] = {:mode => e.format_mode, :sha => e.sha1} end + + #command_lines('ls-tree', sha.to_s).each do |line| + # (info, filenm) = line.split("\t") + # (mode, type, sha) = info.split + # data[type][filenm] = {:mode => mode, :sha => sha} + #end + data end -- cgit