summaryrefslogtreecommitdiff
path: root/lib/bundler/source.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/source.rb')
-rw-r--r--lib/bundler/source.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 774ec86c24..a8afa17666 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -333,7 +333,7 @@ module Bundler
private
def update
if location.directory?
- fetch
+ fetch if @ref && current_revision != @ref
else
clone
end
@@ -350,6 +350,10 @@ module Bundler
`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