summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.(none)>2007-11-19 07:50:33 -0800
committerscott Chacon <schacon@agadorsparticus.(none)>2007-11-19 07:50:33 -0800
commitd7479317e33ec08d6a7a0d841722058c2b6aa98a (patch)
treee09cbfbfbdff3cfb1af654a864257841f2370886
parent824ab0ec43a3c9306e75e87537f8e2b3bcc3254e (diff)
downloadthird_party-ruby-git-d7479317e33ec08d6a7a0d841722058c2b6aa98a.zip
third_party-ruby-git-d7479317e33ec08d6a7a0d841722058c2b6aa98a.tar.gz
third_party-ruby-git-d7479317e33ec08d6a7a0d841722058c2b6aa98a.tar.xz
more speed improvements
-rw-r--r--camping/gitweb.rb7
-rw-r--r--lib/git/branch.rb2
-rw-r--r--lib/git/lib.rb3
-rw-r--r--lib/git/object.rb3
4 files changed, 11 insertions, 4 deletions
diff --git a/camping/gitweb.rb b/camping/gitweb.rb
index eb9417c..bae922a 100644
--- a/camping/gitweb.rb
+++ b/camping/gitweb.rb
@@ -1,6 +1,6 @@
require 'rubygems'
require 'camping'
-require 'git'
+require 'lib/git'
#
# gitweb is a web frontend on git
@@ -207,8 +207,9 @@ module GitWeb::Views
h1 @repo.name
h2 @repo.path
+ gtags = @git.tags
@tags = {}
- @git.tags.each { |tag| @tags[tag.sha] ||= []; @tags[tag.sha] << tag.name }
+ gtags.each { |tag| @tags[tag.sha] ||= []; @tags[tag.sha] << tag.name }
url = 'http:' + URL(Fetch, @repo.id, '').to_s
@@ -247,7 +248,7 @@ module GitWeb::Views
end
h3 'tags'
- @git.tags.each do |tag|
+ gtags.each do |tag|
li { a tag.name, :href => R(Commit, @repo, tag.sha) }
end
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'])