From e1c2fef5939a1fc81ba4ed1ce1e1660f7a3aad2a Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 3 Oct 2025 15:54:37 -0700 Subject: [PATCH] Fix creating pull request failure when the target branch name is the same as some tag (#35552) Use full reference name in the git command to avoid ambiguity. Fix #35470 --- services/pull/temp_repo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/pull/temp_repo.go b/services/pull/temp_repo.go index 8750b4288a..09225079f5 100644 --- a/services/pull/temp_repo.go +++ b/services/pull/temp_repo.go @@ -139,7 +139,7 @@ func createTemporaryRepoForPR(ctx context.Context, pr *issues_model.PullRequest) return nil, nil, fmt.Errorf("Unable to add base repository as origin [%s -> tmpBasePath]: %w\n%s\n%s", pr.BaseRepo.FullName(), err, prCtx.outbuf.String(), prCtx.errbuf.String()) } - if err := gitcmd.NewCommand("fetch", "origin").AddArguments(fetchArgs...).AddDashesAndList(pr.BaseBranch+":"+baseBranch, pr.BaseBranch+":original_"+baseBranch). + if err := gitcmd.NewCommand("fetch", "origin").AddArguments(fetchArgs...).AddDashesAndList(git.BranchPrefix+pr.BaseBranch+":"+git.BranchPrefix+baseBranch, git.BranchPrefix+pr.BaseBranch+":"+git.BranchPrefix+"original_"+baseBranch). Run(ctx, prCtx.RunOpts()); err != nil { log.Error("%-v Unable to fetch origin base branch [%s:%s -> base, original_base in %s]: %v:\n%s\n%s", pr, pr.BaseRepo.FullName(), pr.BaseBranch, tmpBasePath, err, prCtx.outbuf.String(), prCtx.errbuf.String()) cancel()