From 57abe45b96c253f6bc921b86ef756dcbbce1298c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 16 Feb 2021 16:17:37 +0100 Subject: [PATCH] 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 --- pkg/cmd/pr/merge/merge.go | 5 ----- pkg/cmd/pr/merge/merge_test.go | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/cmd/pr/merge/merge.go b/pkg/cmd/pr/merge/merge.go index 37953060e..7ab2ee076 100644 --- a/pkg/cmd/pr/merge/merge.go +++ b/pkg/cmd/pr/merge/merge.go @@ -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 diff --git a/pkg/cmd/pr/merge/merge_test.go b/pkg/cmd/pr/merge/merge_test.go index 6b3165e61..2f71eda32 100644 --- a/pkg/cmd/pr/merge/merge_test.go +++ b/pkg/cmd/pr/merge/merge_test.go @@ -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()