jj icon indicating copy to clipboard operation
jj copied to clipboard

FR: better detection of commits that were made empty

Open jyn514 opened this issue 5 months ago • 4 comments

Is your feature request related to a problem? Please describe. i have a local change that was merged into main as 52f4fb1b27da2874155062c0c3ccfa67cd0fe291. i still have that change locally, and jj does not think it is a parent of main@origin (cc https://github.com/martinvonz/jj/issues/2978). if i try to rebase it with jj rebase -d main@origin unqytsx, i get a merge conflict:

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4884a7383a...0000000000 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -87,12 +87,18 @@
 
 * `jj workspace root` was aliased to `jj root`, for ease of discoverability
 
+<<<<<<<
++++++++
 * `jj diff` no longer shows the contents of binary files.
 
 * `jj git` now has an `init` command that initializes a git backed repo.
 
 * New template function `surround(prefix, suffix, content)` is added.
 
+%%%%%%%
++* `jj diff` no longer shows the contents of binary files.
++
+>>>>>>>

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 as unqytsx but an empty diff. ideally that change itself should then be dropped (https://github.com/martinvonz/jj/issues/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.

jyn514 avatar Feb 07 '24 04:02 jyn514