From 1eeb797975ad3bc94df88d9251b94b75a6abce84 Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Mon, 14 Jul 2025 17:23:09 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"Fix:=20`gh=20pr=20create`=20prioritiz?= =?UTF-8?q?e=20`--title`=20and=20`--body`=20over=20`--fill`=20w=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b31f38c9460ad452d75bc97a1b38525afe1f8f1e. --- pkg/cmd/pr/create/create.go | 20 ++++++++++++-------- pkg/cmd/pr/create/create_test.go | 22 ---------------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/pkg/cmd/pr/create/create.go b/pkg/cmd/pr/create/create.go index b44f77170..705f46023 100644 --- a/pkg/cmd/pr/create/create.go +++ b/pkg/cmd/pr/create/create.go @@ -388,17 +388,13 @@ func createRun(opts *CreateOptions) error { return err } - if opts.TitleProvided { - state.Title = opts.Title - } - - if opts.BodyProvided { - state.Body = opts.Body - } - var openURL string if opts.WebMode { + if !(opts.Autofill || opts.FillFirst) { + state.Title = opts.Title + state.Body = opts.Body + } if opts.Template != "" { state.Template = opts.Template } @@ -417,6 +413,14 @@ func createRun(opts *CreateOptions) error { return previewPR(*opts, openURL) } + if opts.TitleProvided { + state.Title = opts.Title + } + + if opts.BodyProvided { + state.Body = opts.Body + } + existingPR, _, err := opts.Finder.Find(shared.FindOptions{ Selector: ctx.PRRefs.QualifiedHeadRef(), BaseBranch: ctx.PRRefs.BaseRef(), diff --git a/pkg/cmd/pr/create/create_test.go b/pkg/cmd/pr/create/create_test.go index 5ae5a52e6..bd68f19d9 100644 --- a/pkg/cmd/pr/create/create_test.go +++ b/pkg/cmd/pr/create/create_test.go @@ -1590,28 +1590,6 @@ func Test_createRun(t *testing.T) { }, expectedOut: "https://github.com/OWNER/REPO/pull/12\n", }, - { - name: "web prioritize title and body over fill", - setup: func(opts *CreateOptions, t *testing.T) func() { - opts.WebMode = true - opts.HeadBranch = "feature" - opts.TitleProvided = true - opts.BodyProvided = true - opts.Title = "my title" - opts.Body = "my body" - opts.Autofill = true - return func() {} - }, - cmdStubs: func(cs *run.CommandStubber) { - cs.Register( - "git -c log.ShowSignature=false log --pretty=format:%H%x00%s%x00%b%x00 --cherry origin/master...feature", - 0, - "56b6f8bb7c9e3a30093cd17e48934ce354148e80\u0000second commit of pr\u0000\u0000\n"+ - "3a9b48085046d156c5acce8f3b3a0532cd706a4a\u0000first commit of pr\u0000first commit description\u0000\n", - ) - }, - expectedBrowse: "https://github.com/OWNER/REPO/compare/master...feature?body=my+body&expand=1&title=my+title", - }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {