-
Notifications
You must be signed in to change notification settings - Fork 376
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
Don't introduce new redundant ancestor merges when auto-rebasing #4351
Comments
I agree that this is annoying in practice. I find it difficult to define a behavior that would be consistent and would distinguish "new" redundant ancestor merges from "preexisting" ones. The best I can do is this. If all of the following are true:
then we forget the ancestor This seems to do the "right" thing both in your example of abandoning Another option would be to special-case rebases that happen because of Yet another idea I had would be to have a special command to simplify ancestry, but hopefully we can avoid that. |
What I had in mind was simply to check if a given change has redundant ancestor merges after the rebase and did not have it before. |
Ah, I see. It requires iterating over all the auto-rebased commits an extra time, I didn't think of that. You'd also have to be careful to do it in a way that doesn't break Some inconclusive thoughts: I do consider the current behavior more theoretically correct and in some ways easier to reason about. I'm mildly worried about side effects of trying to do a simplification everywhere, and I'm wondering about having an option to disable it. For these reasons, I'm still tempted to consider only doing this simplification for a small number of commands and only for the immediate parents of (say) the commits being abandoned by I'm not sure which is best at the moment, and which would require fewer corner cases in the implementation. I haven't come up with a compelling example in either direction yet. In any case, I don't necessarily think of this as a bug, but I do think that this is an inconvenience we should try to address if possible. |
I feel the same way, FWIW. I'm not at all sure we should make the change proposed here. |
I just ran into this issue. My All that said, I definitely understand the current reticence here to do anything "automagical" during a rebase. The complexities of these cases certainly seems to warrant caution but, at the same time, it feels the common case should still be tractable to address. I'm not that familiar with jj but would it be possible to use immutability as a factor in whether to dissociate a parent from a rebased commit? i.e. when A's parents B and C are linearized to A -> B -> C, C will now be immutable and could be removed as a parent of A. |
Description
PR #3080 fixed issue #2600. In that bug, we started with something like this:
Now (before PR #3080), simply running
jj describe -m A2 -r q
would result ino
losingq
as parent. That's what the PR fixed.However, perhaps we're too careful not to change the shape of the graph now. In particular, let's say we have this history:
If we now abandon
zu
, we end up with this:In this scenario, the auto-rebase code introduced a new redundant ancestor merge. Perhaps we should at least avoid that. We already avoid it if it results in multiple identical parents.
Specifications
The text was updated successfully, but these errors were encountered: