diff options
author | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-12 17:58:02 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-12 17:58:02 -0800 |
commit | f590869eaa6a4c7f25a1df8eca171a119fcee7ed (patch) | |
tree | a946f572fc3c9f6cbaef60331a2c6ef7db2b86f1 /lib/git/lib.rb | |
parent | 852a0e63d294de874c3311f5e7edf40e2f2ecd60 (diff) | |
download | third_party-ruby-git-f590869eaa6a4c7f25a1df8eca171a119fcee7ed.tar.gz third_party-ruby-git-f590869eaa6a4c7f25a1df8eca171a119fcee7ed.tar.xz third_party-ruby-git-f590869eaa6a4c7f25a1df8eca171a119fcee7ed.zip |
added the tree functions and tests
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| |