From 263d06f6161d9268f1ed0520e7a75a5bb81ad4da Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Wed, 1 Feb 2023 03:35:38 +0200 Subject: [PATCH] Fix wrong hint when deleting a branch successfully from pull request UI (#22673) (#22698) Backport #22673 Fix #18785 Co-authored-by: Lunny Xiao --- routers/web/repo/pull.go | 2 +- tests/integration/pull_merge_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index fc95bbf24..98b78645d 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1381,7 +1381,7 @@ func CleanUpPullRequest(ctx *context.Context) { } func deleteBranch(ctx *context.Context, pr *issues_model.PullRequest, gitRepo *git.Repository) { - fullBranchName := pr.HeadRepo.Owner.Name + "/" + pr.HeadBranch + fullBranchName := pr.HeadRepo.FullName() + ":" + pr.HeadBranch if err := repo_service.DeleteBranch(ctx.Doer, pr.HeadRepo, gitRepo, pr.HeadBranch); err != nil { switch { case git.IsErrBranchNotExist(err): diff --git a/tests/integration/pull_merge_test.go b/tests/integration/pull_merge_test.go index 9bd430084..e14f2bbc3 100644 --- a/tests/integration/pull_merge_test.go +++ b/tests/integration/pull_merge_test.go @@ -187,7 +187,7 @@ func TestPullCleanUpAfterMerge(t *testing.T) { htmlDoc := NewHTMLParser(t, resp.Body) resultMsg := htmlDoc.doc.Find(".ui.message>p").Text() - assert.EqualValues(t, "Branch 'user1/feature/test' has been deleted.", resultMsg) + assert.EqualValues(t, "Branch 'user1/repo1:feature/test' has been deleted.", resultMsg) }) }