summaryrefslogtreecommitdiffstats
path: root/lib/git/lib.rb
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.(none)>2007-11-27 08:06:51 -0800
committerscott Chacon <schacon@agadorsparticus.(none)>2007-11-27 08:06:51 -0800
commit07ebb951368ed31bdaebc2e820c62ced22c8bbe4 (patch)
tree729d483ad8f66cf7907bedbb2d01dec6d2856654 /lib/git/lib.rb
parent3fddf300bd33b356540bee50ae17590ea9b61341 (diff)
downloadthird_party-ruby-git-07ebb951368ed31bdaebc2e820c62ced22c8bbe4.tar.gz
third_party-ruby-git-07ebb951368ed31bdaebc2e820c62ced22c8bbe4.tar.xz
third_party-ruby-git-07ebb951368ed31bdaebc2e820c62ced22c8bbe4.zip
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
Diffstat (limited to 'lib/git/lib.rb')
-rw-r--r--lib/git/lib.rb16
1 files changed, 11 insertions, 5 deletions
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