From 9e8df4b83853b91040ece3a6db424f26fcbad7ca Mon Sep 17 00:00:00 2001 From: Mura Li Date: Tue, 17 Sep 2019 01:27:05 +0800 Subject: [PATCH] Fix pull merge 500 error caused by git-fetch breaking behaviors (#8194) --- modules/pull/merge.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pull/merge.go b/modules/pull/merge.go index 5c5ec610f36..0e9e3b8b145 100644 --- a/modules/pull/merge.go +++ b/modules/pull/merge.go @@ -101,7 +101,7 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor } // Fetch head branch - if err := git.NewCommand("fetch", remoteRepoName, pr.HeadBranch).RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil { + if err := git.NewCommand("fetch", remoteRepoName, fmt.Sprintf("%s:refs/remotes/%s/%s", pr.HeadBranch, remoteRepoName, pr.HeadBranch)).RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil { return fmt.Errorf("git fetch [%s -> %s]: %s", headRepoPath, tmpBasePath, errbuf.String()) }