mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-21 09:06:46 +09:00
Backport https://github.com/go-gitea/gitea/pull/39603 by @silverwind Uses `FetchRemoteCommit`, as v28 has no `FetchRemoteTempCommit`, so no `--no-write-fetch-head` is involved.
This commit is contained in:
1 parent
08c123299a
commit
e66e773a6f
2 files changed
+13
-33
No files matched your search
@@ -17,7 +17,6 @@ import (
|
||||
"gitea.dev/modules/git"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/markup/markdown"
|
||||
repo_module "gitea.dev/modules/repository"
|
||||
"gitea.dev/modules/setting"
|
||||
api "gitea.dev/modules/structs"
|
||||
"gitea.dev/modules/util"
|
||||
@@ -137,21 +136,9 @@ func NewComment(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = pull.LoadIssue(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("load the issue of pull request error", err)
|
||||
return
|
||||
}
|
||||
|
||||
if prHeadCommitID != headBranchCommitID {
|
||||
// force push to base repo
|
||||
err := git.PushManaged(ctx, pull.HeadRepo, pull.BaseRepo, git.PushOptions{
|
||||
Branch: pull.HeadBranch + ":" + prHeadRef,
|
||||
Force: true,
|
||||
Env: repo_module.InternalPushingEnvironment(pull.Issue.Poster, pull.BaseRepo),
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("force push error", err)
|
||||
if err := pull_service.PushToBaseRepo(ctx, pull); err != nil {
|
||||
ctx.ServerError("PushToBaseRepo", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user