summaryrefslogtreecommitdiff
path: root/t/t6425-merge-rename-delete.sh
AgeCommit message (Collapse)AuthorFilesLines
2020-08-10t6425: be more flexible with rename/delete conflict messagesLibravatar Elijah Newren1-1/+2
t6425 was very picky about the exact output message produced by a rename/delete conflict, in a way that just scratches the surface of the mess that was built into merge-recursive. The idea was that it would try to find the possible combinations of different conflict types, and when more than one was present for one path, it would try to provide a combined message that covered all the cases. There's a lot to unravel here... First, there's a basic conflict type known as modify/delete, which is a content conflict. It occurs when one side deletes a file, but the other modifies it. There is also a path conflict known as a rename/delete. This occurs when one side deletes a path, and the other renames it. This is not a content conflict, it is a path conflict. It will often occur in combination with a content conflict, though, namely a modify/delete. As such, these two were often combined. Another type of conflict that can exist is a directory/file conflict. For example, one side adds a new file at some path, and the other side of history adds a directory at the same path. The path that was "added" could have been put there by a rename, though. Thus, we have the possibility of a single path being affected by a modify/delete, a rename/delete, and a directory/file conflict. In part, this was a natural by-product of merge-recursive's design. Since it was doing a four way merge with the contents of the working tree being the fourth factor it had to consider, it had working tree handling spread all over the code. It also had directory/file conflict handling spread everywhere through all the other types of conflicts. And our testsuite has a huge number of directory/file conflict tests because trying to get them right required modifying so many different codepaths. A natural outgrowth of this kind of structure is conflict messages that combine all the different types that the current codepath is considering. However, if we want to make the different conflict types orthogonal and avoid repeating ourselves and getting very brittle code, then we need to split the messages from these different conflict types apart. Besides, trying to determine all possible permutations is a _royal_ mess. The code to handle the rename/delete/directory/file conflict output is already somewhat hard to parse, and is somewhat brittle. But if we really wanted to go that route, then we'd have to have special handling for the following types of combinations: * rename/add/delete: on side of history that didn't rename the given file, remove the file instead and place an unrelated file in the way of the rename * rename/rename(2to1)/mode conflict/delete/delete: two different files, one executable and the other not, are renamed to the same location, each side deletes the source file that the other side renames * rename/rename(1to2)/add/add: file renamed differently on each side of history, with each side placing an unrelated file in the way of the other * rename/rename(1to2)/content conflict/file location/(D/F)/(D/F)/: both sides modify a file in conflicting way, both rename that file but to different paths, one side renames the directory which the other side had renamed that file into causing it to possibly need a transitive rename, and each side puts a directory in the way of the other's path. Let's back away from this path of insanity, and allow the different types of conflicts to be handled by separate pieces of non-repeated code by allowing the conflict messages to be split into their separate types. (If multiple conflict types affect a single path, the conflict messages can be printed sequentially.) Start this path with a simple change: modify this test to be more flexible and accept the output either merge backend (recursive or the new ort) will produce. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-10Collect merge-related tests to t64xxLibravatar Elijah Newren1-0/+23
The tests for the merge machinery are spread over several places. Collect them into t64xx for simplicity. Some notes: t60[234]*.sh: Merge tests started in t602*, overgrew bisect and remote tracking tests in t6030, t6040, and t6041, and nearly overtook replace tests in t6050. This made picking out relevant tests that I wanted to run in a tighter loop slightly more annoying for years. t303*.sh: These started out as tests for the 'merge-recursive' toplevel command, but did not restrict to that and had lots of overlap with the underlying merge machinery. t7405, t7613: submodule-specific merge logic started out in submodule.c but was moved to merge-recursive.c in commit 18cfc08866 ("submodule.c: move submodule merging to merge-recursive.c", 2018-05-15). Since these tests are about the logic found in the merge machinery, moving these tests to be with the merge tests makes sense. t7607, t7609: Having tests spread all over the place makes it more likely that additional tests related to a certain piece of logic grow in all those other places. Much like t303*.sh, these two tests were about the underlying merge machinery rather than outer levels. Tests that were NOT moved: t76[01]*.sh: Other than the four tests mentioned above, the remaining tests in t76[01]*.sh are related to non-recursive merge strategies, parameter parsing, and other stuff associated with the highlevel builtin/merge.c rather than the recursive merge machinery. t3[45]*.sh: The rebase testcases in t34*.sh also test the merge logic pretty heavily; sometimes changes I make only trigger failures in the rebase tests. The rebase tests are already nicely coupled together, though, and I didn't want to mess that up. Similar comments apply for the cherry-pick tests in t35*.sh. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>