From 05ab747054adf8617fc2e365bfeaed775cb10746 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 19 Jan 2018 07:53:45 +0100 Subject: [PATCH] Force-push to base repo's ref/pull/#/head (#3393) * Force-push to base repo's ref/pull/#/head Fixes force-pushing to pull request branches, otherwise failing with: [...gitea/models/pull.go:1022 AddTestPullRequestTask()] [E] PushToBaseRepo: Push: exit status 1 - To /path/to/gitea-repositories/org/repo.git ! [rejected] issue-fix -> refs/pull/20/head (non-fast-forward) * format --- models/pull.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/pull.go b/models/pull.go index 5c54a2268..45fe852e9 100644 --- a/models/pull.go +++ b/models/pull.go @@ -1010,6 +1010,7 @@ func (pr *PullRequest) PushToBaseRepo() (err error) { if err = git.Push(headRepoPath, git.PushOptions{ Remote: tmpRemoteName, Branch: fmt.Sprintf("%s:%s", pr.HeadBranch, headFile), + Force: true, }); err != nil { return fmt.Errorf("Push: %v", err) }