Fix Pull Merge when tag with same name as base branch exist (#13882)

fix dst refspec error in 'Push back to upstream' when base branch have
same name with a tag.

fix #13851
Signed-off-by: a1012112796 <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: zeripath <[email protected]>
This commit is contained in:
a1012112796
2020-12-08 02:46:50 +01:00
committed by GitHub
co-authored by 6543 zeripath
parent a33db35b38
commit 682f0b0460
+1 -1
View File
@@ -411,7 +411,7 @@ func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.Merge
)
// Push back to upstream.
if err := git.NewCommand("push", "origin", baseBranch+":"+pr.BaseBranch).RunInDirTimeoutEnvPipeline(env, -1, tmpBasePath, &outbuf, &errbuf); err != nil {
if err := git.NewCommand("push", "origin", baseBranch+":refs/heads/"+pr.BaseBranch).RunInDirTimeoutEnvPipeline(env, -1, tmpBasePath, &outbuf, &errbuf); err != nil {
if strings.Contains(errbuf.String(), "non-fast-forward") {
return "", &git.ErrPushOutOfDate{
StdOut: outbuf.String(),