mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-13 06:20:24 +00:00
feat: expose AGit topic branch in API PR head label (#12352)
For Agit-flow pull requests, `head.label` was explicitly set to an empty string. The head branch name (which contains the Agit topic, e.g. `user2/my-topic`) was already populated from `pr.HeadBranch` but then discarded. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12352 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Cyborus <cyborus@disroot.org>
This commit is contained in:
parent
ffd10d37a6
commit
3a35c5353e
2 changed files with 2 additions and 1 deletions
|
|
@ -177,7 +177,6 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u
|
|||
}
|
||||
apiPullRequest.Head.RepoID = pr.BaseRepoID
|
||||
apiPullRequest.Head.Repository = apiPullRequest.Base.Repository
|
||||
apiPullRequest.Head.Name = ""
|
||||
}
|
||||
|
||||
if pr.HeadRepo != nil && pr.Flow == issues_model.PullRequestFlowGithub {
|
||||
|
|
|
|||
|
|
@ -860,6 +860,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
|
|||
assert.False(t, prMsg.HasMerged)
|
||||
assert.Contains(t, "Testing commit 1", prMsg.Body)
|
||||
assert.Equal(t, commit, prMsg.Head.Sha)
|
||||
assert.Equal(t, "user2/"+headBranch, prMsg.Head.Name)
|
||||
|
||||
_, _, err = git.NewCommand(git.DefaultContext, "push", "origin").AddDynamicArguments("HEAD:refs/for/master/test/" + headBranch).RunStdString(&git.RunOpts{Dir: dstPath})
|
||||
require.NoError(t, err)
|
||||
|
|
@ -878,6 +879,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
|
|||
prMsg = doAPIGetPullRequest(*ctx, ctx.Username, ctx.Reponame, pr2.Index)(t)
|
||||
|
||||
assert.Equal(t, "user2/test/"+headBranch, pr2.HeadBranch)
|
||||
assert.Equal(t, "user2/test/"+headBranch, prMsg.Head.Name)
|
||||
assert.False(t, prMsg.HasMerged)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue