mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-24 12:14:27 +02:00
fix(pull): refresh commits behind when an AGit pull request is updated (#39613)
Fixes #39598 The AGit update path in `services/agit` moved `refs/pull/N/head` without recomputing commits_behind. 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: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
1 parent
bd2a6c40d7
commit
1264072754
3 files changed
+25
-25
No files matched your search
@@ -109,6 +109,8 @@ func TestAgitPullPush(t *testing.T) {
|
||||
assert.NoError(t, pr.LoadIssue(t.Context()))
|
||||
assert.Equal(t, "test-title", pr.Issue.Title)
|
||||
assert.Equal(t, "test-description", pr.Issue.Content)
|
||||
assert.Equal(t, 0, pr.CommitsBehind)
|
||||
assert.Equal(t, 1, pr.CommitsAhead)
|
||||
|
||||
// commit 2
|
||||
_, err = generateCommitWithNewData(t.Context(), testFileSizeSmall, dstPath, "user2@example.com", "User Two", "branch-data-file-2-")
|
||||
@@ -119,6 +121,9 @@ func TestAgitPullPush(t *testing.T) {
|
||||
WithDir(dstPath).
|
||||
Run(t.Context())
|
||||
assert.NoError(t, err)
|
||||
pr = unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{BaseRepoID: 1, Flow: issues_model.PullRequestFlowAGit, HeadBranch: "user2/test-agit-push"})
|
||||
assert.Equal(t, 0, pr.CommitsBehind)
|
||||
assert.Equal(t, 2, pr.CommitsAhead)
|
||||
|
||||
// reset to first commit
|
||||
err = gitcmd.NewCommand("reset", "--hard", "HEAD~1").WithDir(dstPath).Run(t.Context())
|
||||
|
||||
Reference in new issue
Block a user