Fix false unpushed commit warnings for worktree archive (#1158)

* fix(server): avoid false unpushed worktree commits

* fix(server): preserve local-only worktree push counts
This commit is contained in:
Mohamed Boudra
2026-05-24 12:41:36 +08:00
committed by GitHub
parent 94bccf19ba
commit 79dcbdc1c1
2 changed files with 57 additions and 6 deletions
@@ -493,6 +493,53 @@ const x = 1;
expect(status.aheadOfOrigin).toBeNull();
});
it("does not report full history as unpushed for fresh no-track Paseo worktrees", async () => {
setupRemoteTrackingMain(repoDir, tempDir);
commitFile(repoDir, "second.txt", "second\n", "second commit");
execFileSync("git", ["push"], { cwd: repoDir });
const worktree = await createLegacyWorktreeForTest({
branchName: "fresh-feature",
cwd: repoDir,
baseBranch: "main",
worktreeSlug: "fresh-feature",
paseoHome,
});
const status = await getCheckoutStatus(worktree.worktreePath, { paseoHome });
expect(status).toMatchObject({
isGit: true,
isPaseoOwnedWorktree: true,
baseRef: "main",
aheadBehind: { ahead: 0, behind: 0 },
aheadOfOrigin: 0,
});
});
it("reports local-only worktree commits as unpushed relative to base", async () => {
setupRemoteTrackingMain(repoDir, tempDir);
commitFile(repoDir, "second.txt", "second\n", "second commit");
execFileSync("git", ["push"], { cwd: repoDir });
const worktree = await createLegacyWorktreeForTest({
branchName: "fresh-feature",
cwd: repoDir,
baseBranch: "main",
worktreeSlug: "fresh-feature",
paseoHome,
});
commitFile(worktree.worktreePath, "feature.txt", "feature\n", "feature commit");
const status = await getCheckoutStatus(worktree.worktreePath, { paseoHome });
expect(status).toMatchObject({
isGit: true,
isPaseoOwnedWorktree: true,
baseRef: "main",
aheadBehind: { ahead: 1, behind: 0 },
aheadOfOrigin: 1,
});
});
it("does not report incoming additions when the base branch is behind its remote", async () => {
const { cloneDir } = setupRemoteTrackingMain(repoDir, tempDir);
commitFile(cloneDir, "file.txt", "remote one\nremote two\n", "remote update");