fix(git): omit git_reflog old_sha under all=True (interleaved refs)#187
Conversation
old_sha is derived from the adjacent reflog entry, which is only valid for a single ref (newest-first). Under all=True, entries from different refs are interleaved, so the next entry may belong to another ref and old_sha would be wrong. Omit old_sha entirely when all=True; keep it for single-ref reflogs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @MementoRC's task —— View job PR Review: fix(git): omit git_reflog old_sha under all=True (interleaved refs)Tasks:
SummaryThis is a clean, focused correctness fix. The logic is sound and the PR is well-scoped. Code Review:
|
Follow-up to #185 (git_reflog), addressing the
old_sha-under-all=Truecorrectness caveat flagged during that review.Problem
git_reflogderives each entry'sold_shafrom the adjacent entry (entries[i].old_sha = entries[i+1].new_sha), which is valid because a single ref's reflog is newest-first. But underall=True(git reflog --all), entries from different refs are interleaved, so the next entry can belong to another ref and the derivedold_shais wrong.Fix
Only derive
old_shafor single-ref reflogs (all=False). Underall=True, omitold_shaentirely rather than emit a wrong value:Docstring updated to state
old_shais provided only for single-ref reflogs; omitted underall=Truebecause interleaved histories make adjacent-entry derivation unreliable.new_sha/label/action/messageare unaffected.Test plan
test_git_reflog_all_true_omits_old_sha_from_every_entry; existingall=Falsederivation tests unchanged.pixi run -e quality test-unit— passes (exit 0)pixi run -e quality lint(ruff F,E9) — clean🤖 Generated with Claude Code