-
Notifications
You must be signed in to change notification settings - Fork 390
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: better detection of commits that were made empty #2979
Comments
I think you're right that git does this better. It calculates a "patch id" (basically a hash of a context-less diff output, IIRC) for the commits to rebase and for the upstream commits. Then it skips rebasing the commits that match a patch in upstream. I have been thinking of doing something similar in the planned |
sounds great :)
slightly offtopic, but i'm strongly in favor of not blocking this on a new that's not to say i don't think jj sync will get implemented, but i think it would benefit greatly from being scoped down, at least at first. |
My ideal solution would be to create a conflict theory that can keep track of this, so that all conflicts are simplified better. This may be easier said than done, so jyn's remark about scoping down applies to this idea as well. |
This also sounds like this would address behavior I'm seeing:
Also, I didn't see it mentioned, but if this smarter "skip commit already in rebase target (?)" logic is implemented, it would be nice if it were the default behavior. |
I've been thinking about this for a while since I've run into this a few times, and I wonder if If commits
This seems simpler to me since the patch IDs wouldn't need to be computed for every commit, which could be expensive, and we wouldn't need to cache the patch IDs anywhere. It does rely on the assumption that the author and author timestamp are the same after rebase, but that feels pretty safe to me. |
It might be simpler to just rely on patch id (or change id if the backend or forge natively supports it.) Computing hash of diffs wouldn't be expensive compared to actual rebasing. We can of course add some heuristics based on signature, though. |
The main reason I was thinking that actually checking the rebased trees match could be better is that it might be correct in more scenarios. Specifically if there's a situation where |
please do not base this off author + commit message. i would like to be able to rebase other people's branches, and i would like to edit my commit messages, and breaking a core feature like this when that happens is very unexpected. |
Is your feature request related to a problem? Please describe.
i have a local change that was merged into main as 52f4fb1. i still have that change locally, and jj does not think it is a parent of
main@origin
(cc #2978). if i try to rebase it withjj rebase -d main@origin unqytsx
, i get a merge conflict:this is very silly; the line it's trying to add is already present in the file, and it was added before the "jj git" line (before in history, the fact it's the line above shouldn't be relevant). so jj should notice that it's empty instead of thinking it's a conflict.
Describe the solution you'd like
jj rebase
should notice the change is now empty and i should end up with a commit with the same description asunqytsx
but an empty diff. ideally that change itself should then be dropped (#229), but that's separate from this issue.Describe alternatives you've considered
Additional context
i am pretty sure this "just works" with git, although i admittedly haven't tested.
The text was updated successfully, but these errors were encountered: