aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJason Karns2016-08-19 10:32:54 -0400
committerJason Karns2016-08-19 10:50:51 -0400
commit07efe1e7716e2659c4fdcf5fef5a7be4ba584bad (patch)
tree755b9f3c38453b7f0af2c14f6e1f9bf089637322 /Library/Homebrew
parent105d7aa5346553408281ca8f7c4eeb02ea8a7c3f (diff)
downloadbrew-07efe1e7716e2659c4fdcf5fef5a7be4ba584bad.tar.bz2
bump-formula-pr now creates non-tracking branches
Without `--no-track`, some git setups may automatically set `origin/master` as the tracked upstream for the newly created branch. This upstream is what hub defaults as --head when opening PRs. By not allowing git to set `origin/master` as upstream, hub can then use the proper --head for the PR. Since hub still needs to know what --head is intended to be, we can set the branch's upstream when pushing: with the --set-upstream option. Fixes #755
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/dev-cmd/bump-formula-pr.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
index d875e42ac..29f6296c4 100644
--- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb
+++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -140,15 +140,15 @@ module Homebrew
formula.path.parent.cd do
branch = "#{formula.name}-#{new_formula_version}"
if ARGV.dry_run?
- ohai "git checkout -b #{branch} origin/master"
+ ohai "git checkout --no-track -b #{branch} origin/master"
ohai "git commit --no-edit --verbose --message='#{formula.name} #{new_formula_version}#{devel_message}' -- #{formula.path}"
ohai "hub fork --no-remote"
ohai "hub fork"
ohai "hub fork (to read $HUB_REMOTE)"
- ohai "git push $HUB_REMOTE #{branch}:#{branch}"
+ ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}"
ohai "hub pull-request --browse -m '#{formula.name} #{new_formula_version}#{devel_message}'"
else
- safe_system "git", "checkout", "-b", branch, "origin/master"
+ safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
safe_system "git", "commit", "--no-edit", "--verbose",
"--message=#{formula.name} #{new_formula_version}#{devel_message}",
"--", formula.path
@@ -156,7 +156,7 @@ module Homebrew
quiet_system "hub", "fork"
remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1]
odie "cannot get remote from 'hub'!" if remote.to_s.empty?
- safe_system "git", "push", remote, "#{branch}:#{branch}"
+ safe_system "git", "push", "--set-upstream", remote, "#{branch}:#{branch}"
safe_system "hub", "pull-request", "--browse", "-m",
"#{formula.name} #{new_formula_version}#{devel_message}\n\nCreated with `brew bump-formula-pr`."
end