jj/cli
Jonas Greitemann 91ffb2a6b3 merge-tools builtin: only delete files from tree which used to exist
This adds a manual regression test for the scenario in issue #5189.

As of #6411, this no longer results in a panic. However, the test still
fails and rightfully so: When following the reproduction for #5189 and
not selecting any change in `jj split`, the split-off (first) commit
will still record the deletion of `folder/.keep` but not the creation of
the file `folder`.

scm-record yields a selected change with `FileMode::Absent` in one of
two cases:
- when an existing file is deleted and this change is selected,
- when a new file is created and this change is not selected.

From the information provided by `File::get_selected_contents()`
alone, it is not possible to distinguish these two cases. In the first
case, the tree definitely needs to change to reflect the deletion, so
it was marked for deletion. In the second case, that deletion marker
("tombstone") usually was just ignored because no such file existed.

However, when the tombstone happens to coindice with a deleted directory
and a new file has been created in its place, but neither change is
selected, then the tombstone had the effect of deleting the directory
from the tree.

This is now fixed by only marking the file for deletion if a
corresponding file mode change to `Absent` has been "checked".
Otherwise, if the file mode change for the creation of a new file is not
"checked", the file can be merely skipped.
2025-06-02 17:40:26 +00:00
..
examples backend: make write_file() take an AsyncRead 2025-05-22 15:33:33 +00:00
src merge-tools builtin: only delete files from tree which used to exist 2025-06-02 17:40:26 +00:00
testing diff: Run external diff tools in their temp dir 2025-05-12 21:34:19 +00:00
tests cli: add missing "commit" label to tx.commit_summary_template() 2025-06-02 00:08:18 +00:00
build.rs build: fix cargo publish by symlinking cli/docs->docs 2024-11-05 17:37:14 -08:00
Cargo.toml backend: make read_file() return a AsyncRead 2025-05-20 13:23:36 +00:00
docs build: fix cargo publish by symlinking cli/docs->docs 2024-11-05 17:37:14 -08:00
LICENSE