Finishing an interrupted switch is refused when the checkout was killed part way #168

Closed
opened 2026-10-26 01:10:29 -05:00 by ethan-hann · 1 comment
Owner

Found in a review with the bundled git: when SavePoint is killed during a switch checkout (index still at the old snapshot, files half rewritten), the noted switch cannot be finished by Switch again: a non-forced git checkout refuses with "Your local changes would be overwritten", RunCheckoutAsync maps it through RefusalFor to DirtyWorkingTreeException and keeps the note. RequireNothingInTheWayAsync returns early for a noted switch, but git itself refuses. Discard still works, so no data is lost, but the finish-the-switch path promised by D45/D49 does not finish. Fix idea: when finishing a noted switch, force only the paths in plan.Touched (the files the interrupted switch was writing), leaving every other file under the normal refusal.

Found in a review with the bundled git: when SavePoint is killed during a switch checkout (index still at the old snapshot, files half rewritten), the noted switch cannot be finished by Switch again: a non-forced git checkout refuses with "Your local changes would be overwritten", RunCheckoutAsync maps it through RefusalFor to DirtyWorkingTreeException and keeps the note. RequireNothingInTheWayAsync returns early for a noted switch, but git itself refuses. Discard still works, so no data is lost, but the finish-the-switch path promised by D45/D49 does not finish. Fix idea: when finishing a noted switch, force only the paths in plan.Touched (the files the interrupted switch was writing), leaving every other file under the normal refusal.
ethan-hann added this to the 1.0 milestone 2026-10-26 01:10:29 -05:00
Author
Owner

Shipped in 0.9.16 (pull request 192).

Shipped in 0.9.16 (pull request 192).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ethan-hann/SavePoint#168
No description provided.