summaryrefslogtreecommitdiffstats
path: root/lib/git/lib.rb
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-12 17:58:02 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-12 17:58:02 -0800
commitf590869eaa6a4c7f25a1df8eca171a119fcee7ed (patch)
treea946f572fc3c9f6cbaef60331a2c6ef7db2b86f1 /lib/git/lib.rb
parent852a0e63d294de874c3311f5e7edf40e2f2ecd60 (diff)
downloadthird_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.rb10
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|