Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Weird behavior of shell variables in git aliases

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:51

Jeff King [off-list ref] writes:
quoted
quoted
Oh, I should have been paying a bit more attention.  I've been assuming
that we were turning "!anything" into { "sh", "-c", "anything", "-" }
followed by the user supplied arguments.
Yeah, I think that would be more useful in general, but...
...
Doesn't it also break a lot of other more garden-variety aliases that
rely on the automagic "$@", like:
Of course, silly me.

Because the most common usage of the alias mechanism is to package the
command name and common options and allow tacking other command line
arguments after them at runtime, and it is silly to require the user to
say "$@" (i.e. 'lg = "log --oneline"' example), any alias that wants to
use positional parameter should do the 'sh -c "$str" -' packaging itself.

So there is nothing to fix after all; I was just confused by seeing the
initial report which was just a usage error.

Sorry for the noise, and thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help