Fix false unpushed commit warnings for worktree archive#1158
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
None.
Type of change
What does this PR do
Fresh Paseo worktrees no longer show every commit in the repository history as "unpushed commits" when the user opens the archive warning.
The status check still preserves the original local-only branch behavior: when a branch has commits ahead of its base but no remote branch yet, those commits count as unpushed. The fix is that the fallback now compares against the known base ref instead of counting the entire branch history.
How did you verify it
Reproduced the bug with a red regression test for a fresh no-track Paseo worktree: before the fix it reported the full branch history as ahead even though it had no commits ahead of base.
Added coverage for both sides of the behavior:
aheadOfOrigin: 0aheadOfOrigin: 1aheadOfOrigin: nullVerified with:
npx vitest run packages/server/src/utils/checkout-git.test.ts --bail=1npm run format:files -- packages/server/src/utils/checkout-git.ts packages/server/src/utils/checkout-git.test.tsnpm run lint -- packages/server/src/utils/checkout-git.ts packages/server/src/utils/checkout-git.test.tsnpm run typechecknpm run formatThe commit hook also reran targeted lint, format check, and typecheck successfully.
Checklist
npm run typecheckpassesnpm run lintpassesnpm run formatran (Biome)