-
Notifications
You must be signed in to change notification settings - Fork 370
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
Rewrite instead of abandoning empty commits. #2766
Conversation
Ah, so it seems the bug wasn't quite what I thought. I think that what you wrote, both in the code and the description, sounds reasonable to me. Could you write a test for this, ideally showing both what happened before and what happens now (in the same commit as the fix)? (Make sure to pull from Optionally, if you are willing to write some tests showing the working copy behavior, that would be nice too. I think there's a good chance this PR will just fix all of #2760 without having to do anything special for the working copy, but I'm not entirely sure. |
In fact, I'm a bit worried that, with this change, in the common case when you are editing an empty commit, I'm not sure if this is the best solution, but we could compare the change id of the working copy before and after the rebase. If they are different, you could do an analogue of |
Also verified that this fails without the previous commit.
My preferred solution would be to just set skip-empty to set |
The failing checks appear to be completely unrelated, and they pass locally. I'm guessing it's a flake, which seems especially likely given that the test is for concurrency. |
This wouldn't fix the problem, only make it more rare. The working copy commit can be emptied by a rebase even if it wasn't empty before. I feel like the behavior of accidentally editing a non-empty commit might be even worse than the original bug. So, I'd prefer doing something about it now. Perhaps if we switch AbandonNewlyEmpty, it will be rare enough to not worry too much about it, but then we might forget to fix it entirely. |
Fixes jj-vcs#2760 Given the tree: ``` A-B-C \ B2 ``` And the command `jj rebase -s B -d B2` We were previously marking B as abandoned, despite the comment stating that we were marking it as being succeeded by B2. This resulted in a call to `rewrite(rewrites={}, abandoned={B})` instead of `rewrite(rewrites={B=>B2}, abandoned={})`, which then made the new parent of `C` into `A` instead of `B2`
See jj-vcs#2766 for discussions
See jj-vcs#2766 for discussions
See jj-vcs#2766 for discussions
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.
Thank you very much for all the updates and for responding to the bug so quickly!
I have a bunch of minor nits. If you don't have the time or the energy, I can implement them myself, so they are optional. Also, I wrote them in a hurry, so my edits may need further editing.
Overall, this looks great to me. For the record, I'm not sure that my suggestion to never abandon working copy commits is the best long-term option; we can change it if we think of something better and/or people find this behavior confusing. However, I think it's a good patch for the bug for now.
See jj-vcs#2766 for discussions
See jj-vcs#2766 for discussions
Looks good, thanks again! |
… empty `@` This demonstrates the minor bug discussed in jj-vcs#2766 (comment) AKA jj-vcs#2869. It's also interesting whether changing the definition of "discardable" commit would affect this test, see jj-vcs#2859 (comment) (I think it won't, but still)
… empty `@` This demonstrates the minor bug discussed in jj-vcs#2766 (comment) AKA jj-vcs#2869. It's also interesting whether changing the definition of "discardable" commit would affect this test, see jj-vcs#2859 (comment) (I think it won't, but still)
… empty `@` This demonstrates the minor bug discussed in jj-vcs#2766 (comment) AKA jj-vcs#2869. It's also interesting whether changing the definition of "discardable" commit would affect this test, see jj-vcs#2859 (comment) (I think it won't, but still)
…est case This demonstrates the minor bug discussed in jj-vcs#2766 (comment) AKA jj-vcs#2869. It's also interesting whether changing the definition of "discardable" commit would affect this test, see jj-vcs#2859 (comment) (I think it won't, but still)
…est case This demonstrates the minor bug discussed in #2766 (comment) AKA #2869. It's also interesting whether changing the definition of "discardable" commit would affect this test, see #2859 (comment) (I think it won't, but still)
Fixes #2760
Given the tree:
And the command
jj rebase -s B -d B2
We were previously marking B as abandoned, despite the comment stating that we were marking it as being succeeded by B2. This resulted in a call to
rewrite(rewrites={}, abandoned={B})
instead ofrewrite(rewrites={B=>B2}, abandoned={})
, which then made the new parent ofC
intoA
instead ofB2