fix: make reset work like git restore (and rename it to restore)#61
Merged
Conversation
…te README + reset-alias tests
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.
Bug
atomic reset <file>was unusable for its most common case.statustells you to run it to discard changes, but it then refused withCannot reset: there are uncommitted changesand told you torecordfirst — even though discarding uncommitted edits is reset's entire job. The guard also checked the whole tree, so an unrelated dirty file blocked resetting the file you actually named. On top of that it surfaced asInternal error(looks like a bug, not a user action).Why
atomic resetis effectivelygit restore: restore the working copy to the last recorded state. Naming a file is explicit consent to discard it — there's nothing to guard against.Changes
Behavior (commit 1)
--force; only a whole-tree reset (no paths) still requires it.RequiresForce, exit 1), notInternal error.reset <added-file>untracks it but keeps it on disk, sostatusstops reporting a phantom "new file".--viewwas silently half-switching views (left stale content); first made it fail fast.Rename (commit 2)
restore(its real semantics =git restore);resetstays as a permanent hidden alias, so existing usage/scripts keep working.--viewentirely — switching views isatomic view switch.statushint, and the guard error text to "restore".Adds unit + binary-driven integration tests for all of the above. Docs (atomic-docs) follow in a separate PR.