Web lists-archives.com

RFE: version-controlled merge rules




Right now, merge rules can get selected in .gitattributes, which is
version-controlled. However, there does not appear to be any way to *define*
custom merge rules which is version controlled.

There are a lot of different files which can benefit from custom merge rules,
especially ones that are in some ways cumulative or version/tree-dependent.
For example, I use this rule to merge version files:

[merge "version"]
        name = Version file merge driver
        driver = sort -V -r %O %A %B | head -1 > %A.tmp.1 && mv -f %A.tmp.1 %A

(Incidentally: the need for an explicit temp file here is frustrating. It
would be better if git could manage the temporary file. Overwriting %A
directly truncates the file too early.  See other email.)

However, I can't even put this in .gitattributes, because doing so would break
any user who *doesn't* have the previous rule defined locally. Even worse, if
this rule needs to change, propagating it to all new users has to be done
manually... never mind if it needs to vary by branch!

The simplest way to address this would presumably be to let the
repository/working directory contain a .gitconfig file that can contain rules
like that.  (Allowing it to be in the repository proper is probably a
requirement for merges to be handled correctly on bare repositories; I'm not
sure how .gitattributes is handled for that.)

	-hpa