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

jj split always includes new files (when using scm-diff-editor) #1916

Closed
chriskrycho opened this issue Jul 26, 2023 · 3 comments
Closed

jj split always includes new files (when using scm-diff-editor) #1916

chriskrycho opened this issue Jul 26, 2023 · 3 comments

Comments

@chriskrycho
Copy link
Collaborator

chriskrycho commented Jul 26, 2023

Description

When adding a new file, I cannot get jj split to not include a newly-added file, regardless of whether it is included in the "diff".

Note: see discussion; this is not strictly a jj issue, but primarily a function of how diff editing tools handle what jj split needs. Workarounds/solutions:

  • Add the file in the first commit and everything else later, then jj move or jj rebase as makes sense.
  • Use a diff editor (including the default, Meld) which allows you to delete the file from the right-hand-side of the merge. scm-diff-editor and ksdiff both struggle here, but other tools get it right.

Steps to Reproduce the Problem

  1. echo "a" > a.txt
  2. jj commit -m "add a"
  3. echo "b" >> a.txt && echo "b" > b.txt
  4. jj split
  5. Only include a.txt in the first commit (and include all of it).

Expected Behavior

b.txt should not be present in the first commit, so this should now show the commit message editor for the first commit.

Actual Behavior

b.txt is present in the first commit, so the result is "Nothing changed".

asciicast

Specifications

  • Platform: macOS 13.4.1 (c)
  • Version: 0.8.0
@martinvonz
Copy link
Owner

I think this is arxanas/git-branchless#995.

@chriskrycho
Copy link
Collaborator Author

Ah, I see. Because of the way the flow works, you have to be able to delete the file. (Kaleidoscope also struggled with this, but Meld seems to handle it fine.) Feels adjacent to #1905. Closing as not a jj issue exactly, but hopefully the existence of the issue here will help other folks.

@ilyagr ilyagr changed the title jj split always includes new files jj split always includes new files when using scm-diff-editor Jul 30, 2023
@ilyagr ilyagr changed the title jj split always includes new files when using scm-diff-editor jj split always includes new files (when using scm-diff-editor) Jul 30, 2023
@ilyagr
Copy link
Collaborator

ilyagr commented Jul 30, 2023

Workaround by @martinvonz from https://discord.com/channels/968932220549103686/969829516539228222/1135299839706529852:

You can work around it by passing the paths you want in the first commit to the command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants