The original code is unnecessarily complicated. I believe my cleanup preserves functionality (one exception below) and is much easier to read. I have proposed this patch a long time ago in #275237 (which was about a different issue but in the same section of the code). In that thread you said that I would rebase and submit again - here we go. You also mentioned that you found a bug in the patch - I don't see it, what is it? The one thing that changes with my patch is that it does only abort when an attempt to replace a directory with a file is made if the file/dir is config protected, otherwise it silently replaces the directory. Reproducible: Always
Created attachment 262495 [details, diff] rebased onto master
Created attachment 269457 [details, diff] rebases patch, fix typo, behave like old code rebased onto master again This also fixes a typo and more importantly it now behave like the original code when a directory on the livefs blocks the merge of a regular file. Previously it did ignore that conflict if that path was not config-protected (and then failed elsewhere).
In other words it should now be functionally identical to the code it replaces. But prettier.