Fix intent-to-add stash restore#2143
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2143 +/- ##
==========================================
+ Coverage 92.39% 92.49% +0.10%
==========================================
Files 122 122
Lines 25815 25813 -2
==========================================
+ Hits 23853 23877 +24
+ Misses 1962 1936 -26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses #2142 by ensuring “intent-to-add” (git add -N/--intent-to-add) file contents are preserved when prek run stashes/restores unstaged changes and a conflicted patch restore forces a rollback of hook modifications.
Changes:
- Adds an integration test reproducing the conflicted stash-restore scenario with an intent-to-add file and validates file contents + intent-to-add status.
- Refactors
WorkTreeKeeperto restore unstaged working tree contents before re-adding intent-to-add index entries (fixing the loss-of-content case).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/prek/tests/run.rs | Adds a regression test for intent-to-add files surviving conflicted stash restore/rollback. |
| crates/prek/src/cli/run/keeper.rs | Refactors worktree cleanup/restore to enforce correct restore ordering and remove the global restore keeper. |
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.
Closes #2142