Skip to content

Commit

Permalink
Add --set-upstream to git push commands.
Browse files Browse the repository at this point in the history
This ensures that a branch pushed using "hub pull-request" has its
upstream branch set to the target of the push.
  • Loading branch information
nex3 committed Dec 7, 2016
1 parent d400838 commit fb40cab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion commands/pull_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func pullRequest(cmd *Command, args *Args) {
if args.Noop {
args.Before(fmt.Sprintf("Would push to %s/%s", remote.Name, head), "")
} else {
err = git.Spawn("push", remote.Name, fmt.Sprintf("HEAD:%s", head))
err = git.Spawn("push", "--set-upstream", remote.Name, fmt.Sprintf("HEAD:%s", head))
utils.Check(err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions features/pull_request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ BODY
Given I make a commit with message "The commit I never pushed"
When I successfully run `hub pull-request -p`
Then the output should contain exactly "the://url\n"
And "git push origin HEAD:topic" should be run
And "git push --set-upstream origin HEAD:topic" should be run

Scenario: Text editor fails with --push
Given the text editor exits with error status
Expand All @@ -853,7 +853,7 @@ BODY
Then the stderr should contain "error using text editor for pull request message"
And the exit status should be 1
And the file ".git/PULLREQ_EDITMSG" should not exist
And "git push origin HEAD:topic" should not be run
And "git push --set-upstream origin HEAD:topic" should not be run

Scenario: Automatically retry when --push resulted in 422
Given The default aruba timeout is 7 seconds
Expand Down

0 comments on commit fb40cab

Please sign in to comment.