-
Notifications
You must be signed in to change notification settings - Fork 365
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
file deletion ignored by jj split
(when using the built-in diff editor)
#3702
Comments
I'm able to reproduce this with # config.toml
# Install scm-diff-editor binary:
# cargo install --git https://github.com/arxanas/scm-record.git --features scm-diff-editor
[ui]
# diff-editor = ":builtin"
diff-editor = "scm-diff-editor"
[merge-tools.scm-diff-editor]
program = "/path/to/scm-diff-editor"
edit-args = ["--dir-diff", "$left", "$right"] |
That's good to know. That means the problem is probably somewhere in cli/src/merge_tools/builtin.rs, in case anyone has time to take a look. |
the code at |
Possibly related to #3526. I missunderstood that one and am actually experiencing the issue describe in here. I could imagine that they are related though. |
I think the most straightforward near-term solution would be as discussed here:
I think disabling line-wise selection and using only file-mode selection for newly-added/-deleted files should be quite tractable without any changes to the data model. (You can still render the file contents in the editor by using If anyone wants to pick it up, let me know and I can provide more guidance. |
Thanks a lot for that explanation! I think if I understand correctly, the main caveat here is that there's no way to differentiate between deleting a file and deleting all the lines out of a file (while keeping the empty file) in
This solution would be very poor imo (newly-added files should also not be causing any issues with file mode anyways, right?). For deleted files, I think the solution would to be to simply use the "before" file mode for any partial splits and to use the "new" file mode, only if all changes are selected. Regarding the linked issue (i.e. files being marked as executable), couldn't you simply add a line to the |
I agree that I would rather not disallow linewise selection for file creation/deletion, and @30350n's interim solution is how I would expect the diff editor to behave anyway (short of a full solution). With @arxanas' interim proposal, we're missing a few key options that I think are hard to express without the linewise diff editor:
@30350n's interim proposal, we have all but the tricky-seeming options:
This has me thinking, could we get some unstable CLI commands to cover the remaining 2 cases in the interim, which I think can be expressed as, "record the presence of empty file $NAME (with mode $MODE)". maybe a
|
I can't really think of any realsitic use cases for the two remaining cases tbh and it's not like you can't work around them already. So additional CLI options seem kind of unnecessary to me. |
Yeah I suppose you can just tools like |
Okay, just took a look at the code and it seems like @emesterhazy already investigated into this a while ago: https://github.com/martinvonz/jj/blob/415c831e306a4259167cf103a7c89a9ec883935d/cli/src/merge_tools/builtin.rs#L435-L461 I just stepped through this code with a debugger and the problem seems to be that |
Also it seems like this is already implemented. |
I think I managed to fix #3846 and this issue now, but I'm running into some side effects which also need to be resolved. I'll share some draft PRs later. |
Thanks! Can you also keep #3846 in mind when doing that? Hopefully your changes end up fixing that bug too. I think there may also be other related bugs. |
Yep, like I said I already fixed that one ^^. Draft PR is here |
jj split
jj split
(built-in diff editor)
jj split
(built-in diff editor)jj split
(when using the built-in diff editor)
I'm not sure if I should make a new issue, but I got a consistent unreachable panic corner case type of thing that seems related to this (there is a possibility this is precisely what you guys are trying to fix 😅) Basically if you replace a folder with a file (in my case it was a symlink) and then try to split you get a panic. minimal repro: λ jj git init test
Initialized repo in "test"
λ cd test
λ mkdir folder
λ touch folder/.keep
λ jj ci -m 'added folder'
Working copy now at: (x) c76fc22 (empty) (no description set)
Parent commit : (u) 9092cba added folder
λ rm -r folder
λ touch folder
λ jj split
Hint: Using default editor ':builtin'; run `jj config set --user ui.diff-editor :builtin` to disabl
e this message.
thread 'main' panicked at cli/src/merge_tools/builtin.rs:205:13:
internal error: entered unreachable code: list of changed files included a tree: TreeId("29a422c192
51aeaeb907175e9b3219a9bed6c616")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
Description
jj split
andjj squash -i
both appear to ignore selected file deletions. This appears to be limited to the default editor (could not reproduce with--tool meld
). They are shown in the diff editor but do not end up in the chosen commit.Steps to Reproduce the Problem
mv foo bar
jj split
jj show @-
jj show @
Expected Behavior
the first commit contains a file addition (bar) and a file deletion (foo)
the second commit is empty
Actual Behavior
the first commit contains a file addition (bar)
the second commit contains a file deletion (foo)
Specifications
The text was updated successfully, but these errors were encountered: