Skip to content

fix(notes): treat unborn HEAD as no commits in rev-list cache paths - #2266

Open
svarlamov-git-ai wants to merge 1 commit into
mainfrom
fix/warm-cache-unborn-head
Open

fix(notes): treat unborn HEAD as no commits in rev-list cache paths#2266
svarlamov-git-ai wants to merge 1 commit into
mainfrom
fix/warm-cache-unborn-head

Conversation

@svarlamov-git-ai

@svarlamov-git-ai svarlamov-git-ai commented Aug 31, 2026

Copy link
Copy Markdown

Bug

Notes cache warm-up errors on repositories with an unborn HEAD (freshly git inited, no commits). warm_cache_for_remote runs git rev-list --max-count=500 <rev> where <rev> falls back to HEAD; on an unborn HEAD this exits 128 with fatal: 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_display has the same latent issue with its rev-list --max-count=<limit> HEAD call.

Fix

Handle the error from the existing rev-list call (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)). Shared is_unknown_revision_error predicate covers both call sites.

Tests

TDD: added unit tests exercising both functions against a TmpRepo with an unborn HEAD (remote configured, no commits); both failed with the exit-128 error before the fix and pass after.

🤖 Generated with Claude Code


Devin Review

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>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants