From f590869eaa6a4c7f25a1df8eca171a119fcee7ed Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Mon, 12 Nov 2007 17:58:02 -0800 Subject: added the tree functions and tests --- lib/git/lib.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/git/lib.rb') diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 13a3b4c..051025c 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -109,6 +109,16 @@ module Git command('cat-file', ['-p', sha]) 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} + end + data + end + def branches_all arr = [] command_lines('branch', '-a').each do |b| -- cgit