Skip to content

Commit d747931

Browse files
author
scott Chacon
committed
more speed improvements
1 parent 824ab0e commit d747931

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

camping/gitweb.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rubygems'
22
require 'camping'
3-
require 'git'
3+
require 'lib/git'
44

55
#
66
# gitweb is a web frontend on git
@@ -207,8 +207,9 @@ def view
207207
h1 @repo.name
208208
h2 @repo.path
209209

210+
gtags = @git.tags
210211
@tags = {}
211-
@git.tags.each { |tag| @tags[tag.sha] ||= []; @tags[tag.sha] << tag.name }
212+
gtags.each { |tag| @tags[tag.sha] ||= []; @tags[tag.sha] << tag.name }
212213

213214
url = 'http:' + URL(Fetch, @repo.id, '').to_s
214215

@@ -247,7 +248,7 @@ def view
247248
end
248249

249250
h3 'tags'
250-
@git.tags.each do |tag|
251+
gtags.each do |tag|
251252
li { a tag.name, :href => R(Commit, @repo, tag.sha) }
252253
end
253254

lib/git/branch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(base, name)
2121
end
2222

2323
def gcommit
24-
@gcommit = @base.object(@full) if !@gcommit
24+
@gcommit = @base.gcommit(@full) if !@gcommit
2525
@gcommit
2626
end
2727

lib/git/lib.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def full_log_commits(opts = {})
8282
end
8383

8484
def revparse(string)
85+
if /\w{40}/.match(string) # passing in a sha - just no-op it
86+
return string
87+
end
8588
command('rev-parse', string)
8689
end
8790

lib/git/object.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ def diff_parent
208208
end
209209

210210
def set_commit(data)
211+
if data['sha']
212+
@sha = data['sha']
213+
end
211214
@committer = Git::Author.new(data['committer'])
212215
@author = Git::Author.new(data['author'])
213216
@tree = Tree.new(@base, data['tree'])

0 commit comments

Comments
 (0)