forked from mirrors/jj
7fda80fc22
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. |
||
---|---|---|
.. | ||
test_bad_locking.rs | ||
test_commit_builder.rs | ||
test_commit_concurrent.rs | ||
test_conflicts.rs | ||
test_default_revset_graph_iterator.rs | ||
test_diff_summary.rs | ||
test_git.rs | ||
test_id_prefix.rs | ||
test_index.rs | ||
test_init.rs | ||
test_load_repo.rs | ||
test_merge_trees.rs | ||
test_merged_tree.rs | ||
test_mut_repo.rs | ||
test_operations.rs | ||
test_refs.rs | ||
test_revset.rs | ||
test_rewrite.rs | ||
test_view.rs | ||
test_working_copy.rs | ||
test_working_copy_concurrent.rs | ||
test_working_copy_sparse.rs | ||
test_workspace.rs |