fix(desktop): never show bogus commit-behind count on shallow clones - #79588
Closed
Bors6656 wants to merge 1 commit into
Closed
fix(desktop): never show bogus commit-behind count on shallow clones#79588Bors6656 wants to merge 1 commit into
Bors6656 wants to merge 1 commit into
Conversation
shallow checkout + merge-base still ran rev-list --count and surfaced the real (but alarming) commit distance (e.g. 4650) in the update pill. Align with hermes_cli/banner.py: ANY shallow clone skips the count and falls back to a tip-SHA compare, so it shows a generic 'update available' instead of a scary, unactionable number. Full clones keep the exact count path unchanged. Updates the test that previously asserted the buggy shallow+merge-base behaves identically to a full clone.
Contributor
|
Closing — superseded by PR #86257 (merged, bf10349), which lands the same behavioral change your PR argued for: shallow checkouts never trust |
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.
Summary
A shallow
hermes-agentcheckout that shares a merge-base withorigin/mainstill runsgit rev-list HEAD..origin/<branch> --countincheckUpdates(), and surfaces the raw (real but alarming) commit distance in the desktop update pill — e.g. 4650 commits behind on a shallow pin that simply hadn't been updated.apps/desktop/electron/update-count.tsonly skipped the count whenisShallow && !hasMergeBase. The shallow-with-merge-base case fell through to the count and produced the bogus large number.This aligns the desktop with the already-correct CLI guard in
hermes_cli/banner.py: any shallow checkout skips the count and falls back to a tip-SHA compare, showing a generic "update available" instead of a scary, unactionable number. Full clones keep the exact-count path unchanged.shouldCountCommits→return !isShallowresolveBehindCount→ binary SHA compare whenisShallow, else the parsed countTest plan
update-count.test.ts: it previously asserted the buggy shallow+merge-base behavior (count kept); now asserts shallow always resolves via SHA compare. Added the missing shallow+merge-base case that produced the 4650.vitest run electron/update-count.test.ts→ 11/11 pass.tsc -p apps/desktop/tsconfig.electron.json --noEmit→ clean.Root cause reference
First reported as the desktop update pill showing "4650 updates" on a shallow install. Mirrors desktop note in
banner.py(shallow clones compare tip SHAs, never count).🤖 Generated with Claude Code