From d7479317e33ec08d6a7a0d841722058c2b6aa98a Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Mon, 19 Nov 2007 07:50:33 -0800 Subject: more speed improvements --- lib/git/branch.rb | 2 +- lib/git/lib.rb | 3 +++ lib/git/object.rb | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/git') diff --git a/lib/git/branch.rb b/lib/git/branch.rb index c2ce810..6c1bc44 100644 --- a/lib/git/branch.rb +++ b/lib/git/branch.rb @@ -21,7 +21,7 @@ module Git end def gcommit - @gcommit = @base.object(@full) if !@gcommit + @gcommit = @base.gcommit(@full) if !@gcommit @gcommit end diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 0d44183..c6d3580 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -82,6 +82,9 @@ module Git end def revparse(string) + if /\w{40}/.match(string) # passing in a sha - just no-op it + return string + end command('rev-parse', string) end diff --git a/lib/git/object.rb b/lib/git/object.rb index 058053c..97a1a17 100644 --- a/lib/git/object.rb +++ b/lib/git/object.rb @@ -208,6 +208,9 @@ module Git end def set_commit(data) + if data['sha'] + @sha = data['sha'] + end @committer = Git::Author.new(data['committer']) @author = Git::Author.new(data['author']) @tree = Tree.new(@base, data['tree']) -- cgit