Re: [PATCH/RFC] git.c: support "!!" aliases that do not move cwd
- From
Jeff King <peff@peff.net>
- Date
- Oct 9, 2016, 06:08 UTC
- Message-ID
- <20161009060801.gyb4k4ks3d62wgwm@sigill.intra.peff.net>
- In-Reply-To
- <20161009060149.voqjoiltqi6jub7g@sigill.intra.peff.net>
On Sun, Oct 09, 2016 at 02:01:49AM -0400, Jeff King wrote:
Show 25 quoted lines
> > So what about this?
> >
> > [alias]
> > d2u = !dos2unix
> > [alias "d2u"]
> > shell = 'f() { git ls-files "$@" | xargs dos2unix; }; f'
> > exec = C:/cygwin64/bin/dos2unix.exe
> >
> > You introduce all kinds of ambiguities here that did not exist before...
>
> If you mean ambiguity between the old "alias.X" and the new "alias.X.*",
> then yes, I think that's an unavoidable part of the transition. IMHO,
> the new should take precedence over the old, and people will gradually
> move from one to the other.
>
> If you mean the ambiguity between alias.X.shell and alias.X.exec in your
> example, the problem is that you have keys with overlapping meanings.
> One solution is "don't do that" (so have a key like "cmd", and another
> to select "shell or git-cmd", etc). Another is to define some rule, like
> "last one wins" (so "exec" overrides "shell" in your example).
>
> I'd prefer the "don't do that" path. The config you showed is
> nonsensical, and it doesn't really matter that much how we behave. But
> it is better still if we have a config scheme that makes it hard to
> write nonsensical things in the first place.Just to be clear on my "don't do that", I don't mean "the user should not do that", but "do not design a config scheme with keys that have overlapping meanings".
-Peff