From 8ee96039aa945b9eef1eb7dfc88113ec466558ff Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 17 Jul 2025 22:01:11 +0800 Subject: [PATCH] Fix some missed GitHeadRefName when renaming (#35102) --- models/issues/pull.go | 2 +- modules/migration/pullrequest.go | 2 +- templates/repo/issue/view_content/pull_merge_instruction.tmpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/issues/pull.go b/models/issues/pull.go index 2ff471b641..4c25b6f0c8 100644 --- a/models/issues/pull.go +++ b/models/issues/pull.go @@ -413,7 +413,7 @@ func (pr *PullRequest) getReviewedByLines(ctx context.Context, writer io.Writer) return committer.Commit() } -// GetGitRefName returns git ref for hidden pull request branch +// GetGitHeadRefName returns git ref for hidden pull request branch func (pr *PullRequest) GetGitHeadRefName() string { return fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index) } diff --git a/modules/migration/pullrequest.go b/modules/migration/pullrequest.go index c832879630..cccab3fd7e 100644 --- a/modules/migration/pullrequest.go +++ b/modules/migration/pullrequest.go @@ -49,7 +49,7 @@ func (p *PullRequest) IsForkPullRequest() bool { return p.Head.RepoFullName() != p.Base.RepoFullName() } -// GetGitRefName returns pull request relative path to head +// GetGitHeadRefName returns pull request relative path to head func (p PullRequest) GetGitHeadRefName() string { return fmt.Sprintf("%s%d/head", git.PullPrefix, p.Number) } diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index 7362908c55..9dbcbeee21 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -11,7 +11,7 @@ {{if eq .PullRequest.Flow 0}}
git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}
{{else}} -
git fetch -u origin {{.PullRequest.GetGitRefName}}:{{$localBranch}}
+
git fetch -u origin {{.PullRequest.GetGitHeadRefName}}:{{$localBranch}}
{{end}}
git checkout {{$localBranch}}