jj/lib/tests
Martin von Zweigbergk 7fda80fc22 tree: simplify conflict before resolving at hunk level
I ran into a bug the other day where `jj status` said there was a
conflict in a file but there were no conflict markers in the working
copy. The commit was created when I squashed a conflict resolution
into the commit's parent. The rebased child commit then ended up in
this state. I.e., it looked something like this before squashing:

```
C (no conflict)
|
| B conflict
|/
A conflict
```

The conflict in B was different from the conflict in A. When I
squashed in C, jj would try to resolve the conflicts by first creating
a 7-way conflict (3 from A, 3 from B, 1 from C). Because of the exact
content-level changes, the 7-way conflict couldn't be automatically
resolved by `files::merge()` (the way it currently works
anyway). However, after simplifying the conflict, it could be
resolved. Because `MergedTree::merge()` does another round of conflict
simplification of the result at the end of the function, it was the
simplifed version that actually got stored in the commit. So when
inspecting the conflict later (e.g. in the working copy, as I did), it
could be automatically resolved.

I think there are at least two ways to solve this. One is to call
`merge_trees()` again after calling `tree.simplify()` in
`MergedTree::merge()`. However, I think it would only matter in the
case of content-level conflicts. Therefore, it seems better to make
the content-level resolution solve this case to start with. I've done
that by simplifying the conflict before passing it into
`files::merge()`. We could even do the fix in `files::merge()`, but
doing it before calling it has the advantage that we can avoid reading
some unchanged content from the backend.
2023-09-27 22:14:39 -07:00
..
test_bad_locking.rs testutils: delete bool-typed init() in favor of enum-typed version 2023-09-18 07:15:37 -07:00
test_commit_builder.rs testutils: delete bool-typed init() in favor of enum-typed version 2023-09-18 07:15:37 -07:00
test_commit_concurrent.rs testutils: delete bool-typed init() in favor of enum-typed version 2023-09-18 07:15:37 -07:00
test_conflicts.rs tests: wherever we test with only one backend, use the test backend 2023-09-19 20:49:41 -07:00
test_default_revset_graph_iterator.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00
test_diff_summary.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00
test_git.rs git: make fetch() import local tags in addition to remote branches 2023-09-26 00:47:00 +09:00
test_id_prefix.rs testutils: delete bool-typed init() in favor of enum-typed version 2023-09-18 07:15:37 -07:00
test_index.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00
test_init.rs testutils: delete bool-typed init() in favor of enum-typed version 2023-09-18 07:15:37 -07:00
test_load_repo.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00
test_merge_trees.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00
test_merged_tree.rs tree: simplify conflict before resolving at hunk level 2023-09-27 22:14:39 -07:00
test_mut_repo.rs tests: test views, operations, and mutable repos only with test backend 2023-09-20 07:47:30 -07:00
test_operations.rs tests: test views, operations, and mutable repos only with test backend 2023-09-20 07:47:30 -07:00
test_refs.rs tests: wherever we test with only one backend, use the test backend 2023-09-19 20:49:41 -07:00
test_revset.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00
test_rewrite.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00
test_view.rs tests: test views, operations, and mutable repos only with test backend 2023-09-20 07:47:30 -07:00
test_working_copy.rs tests: use test backend in working copy tests, fix MergedTree bug 2023-09-19 20:49:41 -07:00
test_working_copy_concurrent.rs tests: use test backend in working copy tests, fix MergedTree bug 2023-09-19 20:49:41 -07:00
test_working_copy_sparse.rs tests: wherever we test with only one backend, use the test backend 2023-09-19 20:49:41 -07:00
test_workspace.rs test: use test backend in most remaining tests too 2023-09-24 21:24:01 -07:00