fix(update): handle NoLocalChanges on auto-stash false positive#68
Conversation
|
Reviewed @junjitree — checked out the head, built, tested, and ran clippy:
A few non-blocking points to address before merge:
Nice catch on the stat-cache false positive — that's a subtle one. |
sha2 0.11 digest output no longer implements LowerHex, so format the hash bytes manually instead of using {:x}.
gix::repository::is_dirty() can return true due to stat-cache staleness even when no files have actually changed. When gix::stash::push then compares tree contents it finds nothing to stash and returns PushError::NoLocalChanges, causing krypt update to bail with "auto-stash push failed: no local changes to save". Treat NoLocalChanges as a clean-tree signal and skip the stash instead of propagating the error.
738fe56 to
20c97f8
Compare
|
Hark, good @mxaddict, and accept mine humble thanks for thy most thorough scrutiny. Thy counsel hath been heeded in full:
The branch is freshly force-pushed (with lease). I remain in thy debt for the sharp eye upon the stat-cache deceiver. |
|
Hark, @junjitree! Thy patch I have once more beheld, and lo — it standeth true. ✅ The commits thou hast cloven in twain, each unto its own purpose, and thy name now sitteth rightly upon the ledger of history. The branch I did fetch, build, and put to trial: eight-and-thirty above two hundred tests didst pass, and clippy spake not a word of complaint. The arm that catcheth Naught remaineth save the manual proving of Right well done, good sir. Ship it when thou art ready. 🚢 |
Problem
krypt updatefails with:when the working tree is actually clean.
Root cause:
gix::repository::is_dirty()can returntruedue tostat-cache staleness (file timestamps differ from what git recorded, but
file content is unchanged). When
gix::stash::pushthen compares theactual tree contents it finds nothing to stash and returns
PushError::NoLocalChanges. krypt propagates this as an error instead oftreating it as "nothing to do".
Reproduced by: pulling/merging manually, then running
krypt updateon analready-clean repo.
Fix
In
gix_ff_pull, matchPushError::NoLocalChangesand treat it as aclean-tree signal — skip the stash and continue normally.
A separate commit fixes a pre-existing
sha2 = "0.11"API break inmanifest.rswheredigest.finalize()output no longer implementsLowerHex. Formats the bytes manually instead. Without this fix the cratedoes not compile, so the two commits are bundled in one PR.
Test plan
cargo test -p krypt-corepasses (238 tests) — also verifiedcargo build+cargo clippycleankrypt updateon a clean repo no longer errorskrypt updateon a dirty repo still auto-stashes correctly