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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user