From: Elijah Newren Date: Fri, 23 Oct 2020 17:40:28 GMT Subject: Re: [PATCH 2/9] merge tests: expect improved directory/file conflict handling in ort Message-ID: In-Reply-To: <9394d526f1425fcf6b8865b53b737ba81c11dd80.1603468885.git.gitgitgadget@gmail.com> On Fri, Oct 23, 2020 at 9:01 AM Elijah Newren via GitGitGadget wrote: > > From: Elijah Newren > > merge-recursive.c is built on the idea of running unpack_trees() and > then "doing minor touch-ups" to get the result. Unfortunately, > unpack_trees() was run in an update-as-it-goes mode, leading > merge-recursive.c to follow suit and end up with an immediate evaluation > and fix-it-up-as-you-go design. Some things like directory/file > conflicts are not well representable in the index data structure, and > required special extra code to handle. But then when it was discovered > that rename/delete conflicts could also be involved in directory/file > conflicts, the special directory/file conflict handling code had to be > copied to the rename/delete codepath. ...and then it had to be copied > for modify/delete, and for rename/rename(1to2) conflicts, ...and yet it > still missed some. Further, when it was discovered that there were also > file/submodule conflicts and submodule/directory conflicts, we needed to > copy the special submodule handling code to all the special cases > throughout the codebase. > > And then it was discovered that our handling of directory/file conflicts > was suboptimal because it would create untracked files to store the > contents of the conflicting file, which would not be cleaned up if > someone were to run a 'git merge --abort' or 'git rebase --abort'. It > was also difficult or scary to try to add or remove the index entries > corresponding to these files given the directory/file conflict in the > index. But changing merge-recursive.c to handle these correctly was a > royal pain because there were so many sites in the code with similar but > not identical code for handling directory/file/submodule conflicts that > would all need to be updated. > > I have worked hard to push all directory/file/submodule conflict > handling in merge-ort through a single codepath, and avoid creating > untracked files for storing tracked content (it does record things at > alternate paths, but makes sure they have higher-order stages in the > index). > > Since updating merge-recursive is too much work and we don't want to > destabilize it, instead update the testsuite to have different > expectations for relevant directory/file/submodule conflict tests. > > Signed-off-by: Elijah Newren Perhaps I should also mention that these changes to directory/file conflict handling were discussed previously in the thread at https://lore.kernel.org/git/xmqqbmabcuhf.fsf@gitster-ct.c.googlers.com/. I just never got around to a complete implementation within merge-recursive.c, but did implement it in merge-ort.c I still haven't gotten around to fixing up git-mv and git-rm as suggested by Junio in that thread; but at least I've finally gotten the merge machinery side written...