Avoid clobbering top-level .gitignore files
To avoid changes in the test suite, the gitignore refactoring generated the default top-level .gitignore if there was no already generated file there. But that could overwrite a top-level in-tree .gitignore (only at branch roots due to a guard).
Instead, handle that toplevel .gitignore like the others and refuse to ovewrite in-tree content. This together with the inheritance computation means that there is no longer a need to explicitly testing whether the commit is a branch root.