Repository navigation
update: fix UPDATE-04, UPDATE-07 - #25
Merged
Merged
Conversation
kridaydave
force-pushed
the
fix/pr-03-update-destructive-order
branch
from
November 8, 2026 18:25
51c409a to
2ec312e
Compare
Check for untracked overwrite collisions before mutating the working tree so a bail does not leave deletions applied and writes undone. Report directory and read errors clearly instead of skipping the check and failing later during rename. Fixes UPDATE-04, UPDATE-07.
TST2-03 removed fn jj_available() but merge of X-09 added tests that still called it. Match the #[ignore = "requires jj"] pattern.
kridaydave
force-pushed
the
fix/pr-03-update-destructive-order
branch
from
November 8, 2026 19:04
c9d17a8 to
2a4ccd8
Compare
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.
Bugs
What was wrong
src/update.rs:195,256(straight path) andsrc/update.rs:421,525(merge path): the code deleted tracked files first, then checked whether target writes would overwrite an untracked path. A bail at that check left deletions applied and writes undone, with no rollback.src/update.rs:258,525: the untracked-overwrite guard usedif let Ok(existing_bytes) = std::fs::read(&full), so read failures (directory, permission, dangling-target cases) skipped the bail.write_file_atomicthen failed later (for example, renaming over a directory) after deletes had already run.Fix
check_untracked_overwriteandvalidate_untracked_writeshelpers. They inspect existing paths withsymlink_metadata, bail with a clear message for directories, propagate read/inspect errors with context, and compare bytes before allowing an overwrite.run): validate all untracked snapshot writes before any delete when not--force.materialize_merge): validate untracked collisions for paths that will be written before any delete.Verification
CI green (fmt, clippy, tests, release build, adjudication) + regression tests
test_update_untracked_collision_does_not_delete_before_bail,test_update_untracked_symlink_collision_does_not_delete_before_bail, andtest_update_merge_untracked_collision_does_not_delete_before_bailintests/update_test.rs.