I have a project that has some files that are fragile in a sense that slight errors may cause security problems even if full program seems to work okay. As a result, I'd like git to always verify the result of any automatic modification during merge.
If I've understood correctly, a custom merge driver is pretty much what I want. The best I've figured out is to use git-merge-file in a custom merge driver to get the normal merge result and just exit 1 to mark the result as conflicting always. This way git will stop during merge and I can inspect the merge result before completing the merge.
However, the expected changes to that file are very small and the best way would be able to run something similar to "git add -i" and selecting "patch" and applying one hunk at a time.
Is there a simple way to write a merge driver that behaves like "git add -i" for all merges to that file (where the possible hunk to apply is the result of automatic merge)?
In addition, if I've understood correctly, the merge driver will be called only for file level conflicts. Is it possible to request similar manual verification for specially marked files? I'm thinking marking a new file as "fragile" in gitattributes before doing the merge and then some git merge magic (or filter magic) would request me to verify that the new special file is okay for the merged branch.