git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* RFE: version-controlled merge rules
@ 2018-12-27 20:16 H. Peter Anvin
  2018-12-27 23:55 ` Jonathan Nieder
  2018-12-28  8:42 ` Ævar Arnfjörð Bjarmason
  0 siblings, 2 replies; 7+ messages in thread
From: H. Peter Anvin @ 2018-12-27 20:16 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-29  9:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27 20:16 RFE: version-controlled merge rules H. Peter Anvin
2018-12-27 23:55 ` Jonathan Nieder
2018-12-28  4:48   ` H. Peter Anvin
2018-12-28 16:03     ` Duy Nguyen
2018-12-28 14:35   ` Junio C Hamano
2018-12-29  9:14     ` hpa
2018-12-28  8:42 ` Ævar Arnfjörð Bjarmason

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).