Skip to content
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

The builtin diff editor for jj split mishandles truncating a file to 0 bytes #3526

Open
emesterhazy opened this issue Apr 17, 2024 · 3 comments
Labels
scm-record Issues relating to the scm-record library, used as the default interactive diff/merge editor.

Comments

@emesterhazy
Copy link
Contributor

emesterhazy commented Apr 17, 2024

Steps to Reproduce the Problem

  1. Create a text file with contents and commit it.
  2. Create a second commit that truncates the contents to zero bytes but does not delete the file.
  3. Split the second commit and select all of the changes (i.e. the truncation).
  4. 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 62b14e1

I synced back to before #3481 and the bug existed then as well. I'm planning to look at this alongside arxanas/scm-record#26 since they're closely related. scm-record has a few rough edges around empty files.

@30350n
Copy link

30350n commented May 10, 2024

Can confirm this happening. As someone who pretty much exclusively uses split this can be quite annoying ^^

@emesterhazy
Copy link
Contributor Author

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.

@30350n
Copy link

30350n commented May 11, 2024

Yeah I totally get that, no worries! Thanks for looking into it ❤️

@arxanas arxanas added the scm-record Issues relating to the scm-record library, used as the default interactive diff/merge editor. label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scm-record Issues relating to the scm-record library, used as the default interactive diff/merge editor.
Projects
None yet
Development

No branches or pull requests

3 participants