undo: prevent restoring to root operation#9071
Open
VedantMadane wants to merge 1 commit intojj-vcs:mainfrom
Open
undo: prevent restoring to root operation#9071VedantMadane wants to merge 1 commit intojj-vcs:mainfrom
VedantMadane wants to merge 1 commit intojj-vcs:mainfrom
Conversation
Member
|
Did you read the comments on the issue you linked to? Could you also fill out our PR template, especially since you said it's made with Cursor? Thanks |
Contributor
I think we should use |
4c4e480 to
800ac22
Compare
When there is only one non-root operation in history, `jj undo` would restore to the root operation which has no working copy, leaving the repo in an unusable state (many commands fail with "This command requires a working copy"). Prevent `jj undo` from restoring to the root operation and show a helpful error message with a hint to use `jj redo`. Fixes jj-vcs#8153
800ac22 to
51090b3
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.
Fixes #8153
When there is only one non-root operation in history,
jj undowould restore to the root operation which has no working copy, leaving the repo in an unusable state (many commands fail with "This command requires a working copy").This prevents
jj undofrom restoring to the root operation and shows a helpful error message with a hint to usejj redo.I read the discussion on the issue @martinvonz suggested warning when the current workspace no longer exists (in
cli_util.rs). The current implementation takes the simpler approach of blocking undo to root, but happy to rework this to check workspace existence instead if that's preferred.Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,demos/)cli/src/config-schema.json)how it works, how it's organized), including any code drafted by an LLM.
an eye towards deleting anything that is irrelevant, clarifying anything
that is confusing, and adding details that are relevant. This includes,
for example, commit descriptions, PR descriptions, and code comments.
Assisted-by: Cursor