fix(notes): treat unborn HEAD as no commits in rev-list cache paths - #2266
Open
svarlamov-git-ai wants to merge 1 commit into
Open
fix(notes): treat unborn HEAD as no commits in rev-list cache paths#2266svarlamov-git-ai wants to merge 1 commit into
svarlamov-git-ai wants to merge 1 commit into
Conversation
warm_cache_for_remote and materialize_notes_for_display run 'git rev-list ... HEAD'. On a repository with an unborn HEAD (freshly initialized, no commits) that command exits 128 with 'unknown revision', and the error propagated up as a daemon side-effect error. Treat that failure like the existing empty-history case: debug-log and skip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
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.
Bug
Notes cache warm-up errors on repositories with an unborn HEAD (freshly
git inited, no commits).warm_cache_for_remoterunsgit rev-list --max-count=500 <rev>where<rev>falls back toHEAD; on an unborn HEAD this exits 128 withfatal: ambiguous argument 'HEAD': unknown revision..., and the error propagates up as a daemon async side-effect error instead of being treated as "no commits" (the function already handles the empty rev-list output case, but not this failure mode).materialize_notes_for_displayhas the same latent issue with itsrev-list --max-count=<limit> HEADcall.Fix
Handle the error from the existing
rev-listcall (no extra git spawn): when it fails with exit code 128 / "unknown revision", treat it exactly like the existing empty-history case — debug-log and skip quietly (Ok(())/Ok(0)). Sharedis_unknown_revision_errorpredicate covers both call sites.Tests
TDD: added unit tests exercising both functions against a
TmpRepowith an unborn HEAD (remote configured, no commits); both failed with the exit-128 error before the fix and pass after.🤖 Generated with Claude Code