Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli rebase: do not allow
-r --skip-empty
to empty descendants
This follows up on @matts1 's jj-vcs#2609. We still allow the `-r` commit to become empty. I would be more comfortable if there was a test for that, but I haven't done that (yet?) and it seems pretty safe. If that's a problem, I'm happy to forbid `-r --skip-empty` entirely, since it is far less useful than `-s --skip-empty` or `-b --skip-empty`. I think it is undesired to abandon emptied descendants, since as far as descendants of `A` are concerned, `jj rebase -r A` should be equivalent to `jj abandon A`, and `jj abandon` does not remove emptied commits. It also doesn't seem very useful to do that to descendant commits, since I think they'd only become empty in pathological cases. Additionally, if we did want -r to empty descendants of `A`, we'd have to add thorough tests and possibly improve the algorithm. I want to refactor `rebase -r` and add features to it, and considering these cases makes everything harder. For example, if we have ``` root -> A -> B -> C ``` and `jj rebase -r A -d C` empties commit `B` (or `C`), I do not know whether the current algorithm will work correctly. It seems possible that it would, but that depends on the fact that empty merge commits are not abandoned for descendants. That seems dangerous to rely on without tests. Making DescendantRebaser return more information (which I am likely to do as part of implementing `-r --after`) should help make such code more obviously correct.
- Loading branch information