-
Notifications
You must be signed in to change notification settings - Fork 343
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
Implement rebase --skip-empty #2609
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for implementing your feature request.
I left a bunch of comments and I want to remind you that we prefer a linear history in this project, so you'll need to squash this into two or three commits. See https://github.com/martinvonz/jj/blob/main/docs/contributing.md#code-reviews
dd50d9a
to
85ff2f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code generally looks good to me, thanks!, but I don't have much expertise around rebase stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG, if you want to you can prefix the first commit with lib:
and the second with cli:
.
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 reasonable not to empty 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 empty anything. Moreover, if we did want -r to empty descendants of `A`, we'd have to improve the algorithm and add thorough tests. For example, if we have root -> A -> B -> C and `jj rebase -r A -d C` empties commit `B` (or `C`), I do not believe the current algorithm will work correctly.
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 reasonable not to empty 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 empty anything. Moreover, if we did want -r to empty descendants of `A`, we'd have to improve the algorithm and add thorough tests. For example, if we have ``` root -> A -> B -> C ``` and `jj rebase -r A -d C` empties commit `B` (or `C`), I do not believe the current algorithm will work correctly.
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 reasonable not to empty 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 emptid commits. It also doesn't seem very useful to do that to descendant commits. Moreover, if we did want -r to empty descendants of `A`, we'd have to improve the algorithm and add thorough tests. 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. That seems dangerous to rely on without tests.
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. That seems dangerous to rely on without tests.
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.
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. 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, since I think descendant commits of an abandoned (or moved with `-r`) commit 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 having to consider cases of commits becoming abandoned 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. I hope (but can't promise) that in the near future, making DescendantRebaser return more information should help make it possible to create such functionality in a more robust way. I am likely to attempt this as part of implementing `-r --after`.
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. 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, since I think descendant commits of an abandoned (or moved with `-r`) commit 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 having to consider cases of commits becoming abandoned 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. I hope (but can't promise) that in the near future, making DescendantRebaser return more information should help make it possible to create such functionality in a more robust way. I am likely to attempt this as part of implementing `-r --after`.
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. 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, since I think descendant commits of an abandoned (or moved with `-r`) commit 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 having to consider cases of commits becoming abandoned 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. I hope (but can't promise) that in the near future, making DescendantRebaser return more information should help make it possible to create such functionality in a more robust way. I am likely to attempt this as part of implementing `-r --after`.
This follows up on @matts1 's #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. 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, since I think descendant commits of an abandoned (or moved with `-r`) commit 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 having to consider cases of commits becoming abandoned 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. I hope (but can't promise) that in the near future, making DescendantRebaser return more information should help make it possible to create such functionality in a more robust way. I am likely to attempt this as part of implementing `-r --after`.
Fixes issue #229. See the issue for discussions.
Checklist
If applicable:
CHANGELOG.md