-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: when abandoning the working copy, use the same children for the new change #4468
Comments
If we make new wc preserve the old children, we might also need to auto-abandon it. Otherwise, an empty wc commit would be left after squashed. |
I think this is the case with the patch I'm proposing, or I didn't understand your concern. |
I assumed the workflow is |
Good point. Indeed, this is currently not the case, as the user is in the same state as if they just used Or should we systematically abandon an empty wc commit when we checkout another one? It may disrupt other workflows, for example |
Another solution would be to make |
True. I'm not sure if the current behavior makes sense. I rarely use editing workflow. Anyway, if we make |
Btw, #4238 seems related. It suggests not ever implicitly creating a new working-copy commit. If we did that, then |
Is your feature request related to a problem? Please describe.
After creating a fix-up commit in the middle of a tree and working on it, I squashed my changes into the parent commit because some more tests passed, but I still intended to continue working on the fix. However, the new commit created after
jj squash
didn't have the same children as I expected: I was now branching out of the tree instead of working in the middle of it.Describe the solution you'd like
I would have liked my new commit to have the same children (same child in my case) as the one who just got emptied, so that I could continue working "at the same place" in the tree.
Describe alternatives you've considered
I could have used
jj squash --keep-emptied
, but I like the idea of abandoning a change when emptying it via squashing and starting a new one.Additional context
The newly created change after abandoning the working copy keeps the same parents as the previous working copy. Also preserving the children would be more consistent.
Backward compatiblity concerns
The change would change the behavior of jj only in one particular scenario:
I think it is unlikely that a user would want to:
jj new --after <CHANGE ID>
, opposed tojj new <CHANGE ID>
to start a new head from this change)Care must be taken to ensure that a plain
jj new
, done while working in an empty change in the middle of the tree, do not preserve the same children, as in this case the goal is clearly to create a new head.The text was updated successfully, but these errors were encountered: