Let the server choose the commit subject for squashed merge

For single-commit PRs, the commit subject will be the subject of the
head commit and the PR number. For multi-commit PRs, the commit subject
will be the PR title and PR number. Instead of trying to replicate this
logic client-side, omit the `commitHeadline` param and let the server
apply defaults appropriately.

Reverts https://github.com/cli/cli/pull/1627
This commit is contained in:
Mislav Marohnić 2021-02-16 16:17:37 +01:00
parent 67bfedd56b
commit 57abe45b96
2 changed files with 1 additions and 6 deletions

View file

@ -229,11 +229,6 @@ func mergeRun(opts *MergeOptions) error {
}
}
if !payload.setCommitSubject && payload.method == PullRequestMergeMethodSquash {
payload.commitSubject = fmt.Sprintf("%s (#%d)", pr.Title, pr.Number)
payload.setCommitSubject = true
}
err = mergePullRequest(httpClient, payload)
if err != nil {
return err

View file

@ -500,7 +500,7 @@ func TestPrMerge_squash(t *testing.T) {
httpmock.GraphQLMutation(`{}`, func(input map[string]interface{}) {
assert.Equal(t, "THE-ID", input["pullRequestId"].(string))
assert.Equal(t, "SQUASH", input["mergeMethod"].(string))
assert.Equal(t, "The title of the PR (#3)", input["commitHeadline"].(string))
assert.NotContains(t, input, "commitHeadline")
}))
_, cmdTeardown := run.Stub()