The builtin diff editor for `jj split` mishandles truncating a file to 0 bytes
Steps to Reproduce the Problem
- Create a text file with contents and commit it.
- Create a second commit that truncates the contents to zero bytes but does not delete the file.
- Split the second commit and select all of the changes (i.e. the truncation).
- After the split, the first commit created by split will be empty and the second commit will truncate the file.
Expected Behavior
The first commit created by split should truncate the file and the second commit should be empty.
Actual Behavior
It's the opposite. The first commit is empty and the second commit truncates the file.
Specifications
- Platform: MacOS
- Version: Built from commit 62b14e1f
I synced back to before https://github.com/martinvonz/jj/pull/3481 and the bug existed then as well. I'm planning to look at this alongside https://github.com/arxanas/scm-record/issues/26 since they're closely related. scm-record has a few rough edges around empty files.
Can confirm this happening. As someone who pretty much exclusively uses split this can be quite annoying ^^
Fixing this upstream ended up being more complicated than I thought it would be and might require a change to the data model. I'm out for a week but I'm going to pick this back up when I'm back.
Yeah I totally get that, no worries! Thanks for looking into it ❤️
This has been fixed by https://github.com/jj-vcs/jj/pull/5486.