Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 174187442eddb3020b47304f4391dff7fdfd1ed2 1 parent f538e3a
Joshua Sierles authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.