ads PR-triggered builds

This commit is contained in:
Michael Hoennig
2026-07-08 06:32:40 +02:00
parent 0e3f97db62
commit 0b17537b7c
7 changed files with 152 additions and 3 deletions
@@ -113,6 +113,19 @@ class GitServiceTest : FunSpec() {
heads["feature/x"] shouldBe fixture.git(fixture.work, "rev-parse", "refs/remotes/origin/feature/x").stdout.trim()
}
test("pullRequestHeads returns the head commits of the remote's pull-request refs") {
val fixture = Fixture()
fixture.pushNewSeedBranch("feature/x")
service.pullRequestHeads(fixture.work) shouldBe emptySet()
// Gitea materializes a pull request as refs/pull/<n>/head on the served repository
fixture.git(fixture.seed, "push", "origin", "refs/heads/feature/x:refs/pull/1/head")
val featureHead = fixture.git(fixture.seed, "rev-parse", "refs/heads/feature/x").stdout.trim()
service.pullRequestHeads(fixture.work) shouldBe setOf(featureHead)
}
test("fetchOrigin picks up new origin branches and prunes deleted ones") {
val fixture = Fixture()
fixture.pushNewSeedBranch("feature/x")