diff options
author | Joshua Sierles <joshua@rasgueado.local> | 2010-01-07 01:22:36 +0100 |
---|---|---|
committer | Joshua Sierles <joshua@rasgueado.local> | 2010-01-07 01:22:36 +0100 |
commit | 174187442eddb3020b47304f4391dff7fdfd1ed2 (patch) | |
tree | e8a819e2d0abbb82b79675f69478853fd5873ea3 | |
parent | f538e3a6759b43aa8cf2fa0953521203c57b641e (diff) | |
download | bundler-174187442eddb3020b47304f4391dff7fdfd1ed2.tar.gz |
speed: don't fetch git repos if a specified ref is already checked out
-rw-r--r-- | lib/bundler/source.rb | 6 |
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 |