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:
Thanos Apollo 2026-05-08 04:46:57 +02:00 committed by Gusted
parent ffd10d37a6
commit 3a35c5353e
2 changed files with 2 additions and 1 deletions

View file

@ -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)
})