diff options
Diffstat (limited to 'lib/git/lib.rb')
-rw-r--r-- | lib/git/lib.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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| |