From 0b776f63761e2ce439af3282b3a4128ce5e9be79 Mon Sep 17 00:00:00 2001 From: Michael Sims Date: Sat, 27 Dec 2025 13:34:38 -0600 Subject: [PATCH] Fix `getOrphanedBranches prunes stale tracking branches` functional test This was failing during the functional test because it assumed there was a "fake remote" (local git repo acting as the "remote" for the test) . The functional test was using a real remote, so we need to make sure branches are deleted properly based on which mode we're in. commit-id: I740f8375 --- .../kotlin/sims/michael/gitjaspr/GitJasprTest.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt index 84834db..4439797 100644 --- a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt +++ b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt @@ -3419,10 +3419,18 @@ interface GitJasprTest { } ) - remoteGit.deleteBranches( - listOf(buildRemoteRef("c"), buildRemoteRef("c_01")), - force = true, - ) + // This could be cleaner. We need the remote branches gone so we can verify that + // getOrphanedBranches does a fetch w/prune before returning results. The mechanism to + // remove the remote branches depends on whether we're using a fake remote. + val remoteBranchesToRemove = listOf(buildRemoteRef("c"), buildRemoteRef("c_01")) + if (useFakeRemote) { + remoteGit.deleteBranches(remoteBranchesToRemove, force = true) + } else { + localGit.push( + remoteBranchesToRemove.map { name -> RefSpec(FORCE_PUSH_PREFIX, name) }, + remoteName, + ) + } assertEquals( listOf(buildRemoteRef("b"), buildRemoteRef("b_01")),