git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: git@vger.kernel.org
Subject: Re: RFE: version-controlled merge rules
Date: Thu, 27 Dec 2018 15:55:26 -0800	[thread overview]
Message-ID: <20181227235526.GF146609@google.com> (raw)
In-Reply-To: <ad875f1e-54e1-e19f-cd65-95ab503c6de2@zytor.com>

Hi,

H. Peter Anvin wrote:

> [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
[...]
> 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.)

The main issue I see is that this would make it a little *too* easy to
run arbitrary code on the user's machine.  Build systems often already
lead to that, but users are more familiar with the risks for build
than for version control.

See [1] for some related discussion.

That said, using the include.path feature (see git-config(1)), it's
possible to do something similar:

	[include]
		path = ../.gitconfig

Thanks and hope that helps,
Jonathan

[1] https://public-inbox.org/git/20171002234517.GV19555@aiede.mtv.corp.google.com/

  reply	other threads:[~2018-12-27 23:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-27 20:16 RFE: version-controlled merge rules H. Peter Anvin
2018-12-27 23:55 ` Jonathan Nieder [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181227235526.GF146609@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hpa@zytor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).