Skip to content
Browse files

speed: don't fetch git repos if a specified ref is already checked out

  • Loading branch information...
1 parent f538e3a commit 174187442eddb3020b47304f4391dff7fdfd1ed2 Joshua Sierles committed Jan 7, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/bundler/source.rb
View
6 lib/bundler/source.rb
@@ -333,7 +333,7 @@ def to_s
private
def update
if location.directory?
- fetch
+ fetch if @ref && current_revision != @ref
else
clone
end
@@ -350,6 +350,10 @@ def clone
`git clone #{@uri} #{location} --no-hardlinks`
end
+ def current_revision
+ Dir.chdir(location) { `git rev-parse HEAD`.strip }
+ end
+
def checkout
Dir.chdir(location) { `git checkout --quiet #{@ref}` }
end

0 comments on commit 1741874

Please sign in to comment.
Something went wrong with that request. Please try again.