summaryrefslogtreecommitdiffstats
path: root/lib/git
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-14 11:00:59 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-14 11:00:59 -0800
commit0e5c33282be67ef2c8c124628b7eb1f46764fdd0 (patch)
treef88d460d89fab2d38d1976eca01defa94df5deee /lib/git
parentf13dfdd5f53d590378245c000c38b39ca1870ad7 (diff)
downloadthird_party-ruby-git-0e5c33282be67ef2c8c124628b7eb1f46764fdd0.tar.gz
third_party-ruby-git-0e5c33282be67ef2c8c124628b7eb1f46764fdd0.tar.xz
third_party-ruby-git-0e5c33282be67ef2c8c124628b7eb1f46764fdd0.zip
added name-rev support for commit objects
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/lib.rb5
-rw-r--r--lib/git/object.rb6
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/git/lib.rb b/lib/git/lib.rb
index 6cebc95..6bddef0 100644
--- a/lib/git/lib.rb
+++ b/lib/git/lib.rb
@@ -73,6 +73,10 @@ module Git
command('rev-parse', string)
end
+ def namerev(string)
+ command('name-rev', string).split[1]
+ end
+
def object_type(sha)
command('cat-file', ['-t', sha])
end
@@ -400,7 +404,6 @@ module Git
#puts out
#puts
if $?.exitstatus > 0
- puts $?.exitstatus
if $?.exitstatus == 1 && out == ''
return ''
end
diff --git a/lib/git/object.rb b/lib/git/object.rb
index c811810..4372463 100644
--- a/lib/git/object.rb
+++ b/lib/git/object.rb
@@ -79,7 +79,7 @@ module Git
super(base, sha)
@mode = mode
end
-
+
def children
blobs.merge(subtrees)
end
@@ -129,6 +129,10 @@ module Git
@message
end
+ def name
+ @base.lib.namerev(@sha)
+ end
+
def gtree
check_commit
Tree.new(@base, @tree)