mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-21 09:06:46 +09:00
Backport #39613 by @dziulatex Fixes #39598 When the base branch has "Block merge if the pull request is outdated" enabled, an AGit pull request that fell behind could never be unblocked: merging the base branch into the topic and pushing it again to the same `refs/for/<branch>/<topic>` left the PR "blocked because it's outdated" forever. The outdated block reads the stored `commits_behind`. Pushing a branch refreshes it for GitHub-flow PRs (`AddTestPullRequestTask`), but the AGit update path in `services/agit` moved `refs/pull/N/head` without recomputing it, so the value only changed when the base branch was pushed, which is the event that makes a PR behind again. The AGit update path now calls `syncCommitDivergence` in `UpdateRefForAgit`, the same as AGit PR creation (`NewPullRequest`) already does. Signed-off-by: dziulatex <paweldziurasoftware@yahoo.com> Co-authored-by: dziulatex <38464243+dziulatex@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
3 files changed
+25
-25
No files matched your search
@@ -252,7 +252,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
|
||||
oldHeadCommitID := pr.HeadCommitID
|
||||
|
||||
pr.HeadCommitID = opts.NewCommitIDs[i]
|
||||
if err = pull_service.UpdateRef(ctx, pr); err != nil {
|
||||
if err = pull_service.UpdateRefForAgit(ctx, pr); err != nil {
|
||||
return nil, fmt.Errorf("failed to update pull ref. Error: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user