diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence-real-git.test.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence-real-git.test.ts index bc66d8a84e5..0609cd7602b 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence-real-git.test.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence-real-git.test.ts @@ -156,6 +156,17 @@ describe('workspace cleanup merge evidence against real Git', () => { expect((await readEvidence(undefined, 'main')).blockers).toEqual(['unpushed-commits']) }) + it('never takes a tag as the base', async () => { + await commitFile(worktreePath, 'a.txt') + await git(['tag', 'release'], worktreePath) + + expect(await readEvidence('release')).toEqual({ + blockers: ['unpushed-commits'], + merge: { headInDefaultBranch: false, aheadOfDefault: 1 }, + reasons: [] + }) + }) + it('keeps unpushed risk for local commits that never landed', async () => { await commitFile(worktreePath, 'a.txt') diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence.ts index bc8d2ebe2e0..3685f654bc3 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup-merge-evidence.ts @@ -125,7 +125,9 @@ async function resolveBranchBaseOid( ref, async (candidate) => (await resolveCommitOid(git, candidate)) !== null ) - if (branchName && worktreeBaseRefFamily(qualified) === branchName) { + const family = worktreeBaseRefFamily(qualified) + // Only a branch can hold landed work; a tag or a name that resolves to nothing is not a base. + if (family === null || family === branchName) { return null } return resolveCommitOid(git, qualified)