Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update to not need special code for :branch (thanks JK)

  • Loading branch information...
commit 57da026218a38f871d4b574039737b37082614a9 1 parent ffef5a1
@wycats wycats authored indirect committed
Showing with 15 additions and 5 deletions.
  1. +1 −2  lib/bundler/source.rb
  2. +14 −3 spec/support/builders.rb
View
3  lib/bundler/source.rb
@@ -268,7 +268,6 @@ class Git < Path
def initialize(options)
super
@uri = options["uri"]
- @branch = options["branch"] || "master"
@ref = options["ref"] || options["branch"] || options["tag"] || 'master'
end
@@ -345,7 +344,7 @@ def cache_path
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)
View
17 spec/support/builders.rb
@@ -371,16 +371,27 @@ def _build(options)
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
Please sign in to comment.
Something went wrong with that request. Please try again.