Merge pull request 'fix: Run full PR checks on agit push' (#4885) from viceice/forgejo:fix/agit/force-push into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4885 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
commit
01affa0908
3 changed files with 63 additions and 37 deletions
|
@ -829,6 +829,9 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
|
|||
if !assert.NotEmpty(t, pr1) {
|
||||
return
|
||||
}
|
||||
assert.Equal(t, 1, pr1.CommitsAhead)
|
||||
assert.Equal(t, 0, pr1.CommitsBehind)
|
||||
|
||||
prMsg, err := doAPIGetPullRequest(*ctx, ctx.Username, ctx.Reponame, pr1.Index)(t)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -849,6 +852,8 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
|
|||
if !assert.NotEmpty(t, pr2) {
|
||||
return
|
||||
}
|
||||
assert.Equal(t, 1, pr2.CommitsAhead)
|
||||
assert.Equal(t, 0, pr2.CommitsBehind)
|
||||
prMsg, err = doAPIGetPullRequest(*ctx, ctx.Username, ctx.Reponame, pr2.Index)(t)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -907,6 +912,14 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
|
|||
assert.False(t, prMsg.HasMerged)
|
||||
assert.Equal(t, commit, prMsg.Head.Sha)
|
||||
|
||||
pr1 = unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{
|
||||
HeadRepoID: repo.ID,
|
||||
Flow: issues_model.PullRequestFlowAGit,
|
||||
Index: pr1.Index,
|
||||
})
|
||||
assert.Equal(t, 2, pr1.CommitsAhead)
|
||||
assert.Equal(t, 0, pr1.CommitsBehind)
|
||||
|
||||
_, _, err = git.NewCommand(git.DefaultContext, "push", "origin").AddDynamicArguments("HEAD:refs/for/master/test/" + headBranch).RunStdString(&git.RunOpts{Dir: dstPath})
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue