diff options
author | wycats <wycats@gmail.com> | 2010-04-01 17:59:03 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-04-01 17:59:14 -0700 |
commit | bc3450ff34c6eed55ec3a3914ad1c00d76e87342 (patch) | |
tree | f287903e455ceeefd02143ce17e15d56ee992eb5 | |
parent | 7514b20dd6d14f867ff150e95b3de804b0965e19 (diff) | |
download | bundler-bc3450ff34c6eed55ec3a3914ad1c00d76e87342.tar.gz |
Update to not need special code for :branch (thanks JK)
-rw-r--r-- | lib/bundler/source.rb | 3 | ||||
-rw-r--r-- | spec/support/builders.rb | 17 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 11744b2cf9..b091916d4f 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -277,7 +277,6 @@ module Bundler def initialize(options) super @uri = options["uri"] - @branch = options["branch"] || "master" @ref = options["ref"] || options["branch"] || options["tag"] || 'master' end @@ -354,7 +353,7 @@ module Bundler def cache if cached? Bundler.ui.info "Updating #{uri}" - in_cache { git %|fetch --quiet "#{uri}" #{@branch}:#{@branch}| } + in_cache { git %|fetch --quiet "#{uri}" refs/heads/*:refs/heads/*| } else Bundler.ui.info "Fetching #{uri}" FileUtils.mkdir_p(cache_path.dirname) diff --git a/spec/support/builders.rb b/spec/support/builders.rb index a2dd541367..2a3b530400 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -371,16 +371,27 @@ module Spec end class GitUpdater < LibBuilder + WINDOWS = Config::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)! + NULL = WINDOWS ? "NUL" : "/dev/null" + + def silently(str) + `#{str} 2>#{NULL}` + end + def _build(options) libpath = options[:path] || _default_path Dir.chdir(libpath) do - `git checkout master` + silently "git checkout master" if branch = options[:branch] raise "You can't specify `master` as the branch" if branch == "master" - `git branch #{branch}` unless `git branch | grep #{branch}`.any? - `git checkout #{branch}` + + unless `git branch | grep #{branch}`.any? + silently("git branch #{branch}") + end + + silently("git checkout #{branch}") end current_ref = `git rev-parse HEAD`.strip |