summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-07-15 10:29:18 -0700
committerCarl Lerche <carllerche@mac.com>2010-07-15 10:29:31 -0700
commitaebee5916f3613cfeec2d751d4db503388901a42 (patch)
tree9af3f4749c4e55791206040cd5473ea6e8a5a4f5 /lib
parentbf367148a45bfc56142db4d4fc32f137e1056f60 (diff)
downloadbundler-aebee5916f3613cfeec2d751d4db503388901a42.tar.gz
Don't remote fetch the git repository if the commit is available locally
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/source.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 404b3925d2..e765c47628 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -595,6 +595,7 @@ module Bundler
def cache
if cached?
+ return if has_revision_cached?
Bundler.ui.info "Updating #{uri}"
in_cache { git %|fetch --force --quiet "#{uri}" refs/heads/*:refs/heads/*| }
else
@@ -620,6 +621,12 @@ module Bundler
end
end
+ def has_revision_cached?
+ return unless @revision
+ git %|cat-file -t #{@revision}|
+ $? == 0
+ end
+
def revision
@revision ||= in_cache { git("rev-parse #{ref}").strip }
end