X Tutup
Skip to content

Commit 57abe45

Browse files
committed
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 cli#1627
1 parent 67bfedd commit 57abe45

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

pkg/cmd/pr/merge/merge.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ func mergeRun(opts *MergeOptions) error {
229229
}
230230
}
231231

232-
if !payload.setCommitSubject && payload.method == PullRequestMergeMethodSquash {
233-
payload.commitSubject = fmt.Sprintf("%s (#%d)", pr.Title, pr.Number)
234-
payload.setCommitSubject = true
235-
}
236-
237232
err = mergePullRequest(httpClient, payload)
238233
if err != nil {
239234
return err

pkg/cmd/pr/merge/merge_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ func TestPrMerge_squash(t *testing.T) {
500500
httpmock.GraphQLMutation(`{}`, func(input map[string]interface{}) {
501501
assert.Equal(t, "THE-ID", input["pullRequestId"].(string))
502502
assert.Equal(t, "SQUASH", input["mergeMethod"].(string))
503-
assert.Equal(t, "The title of the PR (#3)", input["commitHeadline"].(string))
503+
assert.NotContains(t, input, "commitHeadline")
504504
}))
505505

506506
_, cmdTeardown := run.Stub()

0 commit comments

Comments
 (0)
X Tutup