Re: Weird behavior of shell variables in git aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22 March 2011 19:32, Jeff King <peff@xxxxxxxx> wrote:
> On Tue, Mar 22, 2011 at 10:57:08AM -0700, Junio C Hamano wrote:
>> is no longer true; nobody sane would expect that if you made them realize
>> that "simply appended" already.  Just dropping that sentence would make
>> the resulting text flow much better.
>
> Agreed, your version is better.

Good points...

>> I personally think the former "sh -c <str> -" is the more traditional and
>> well understood form (iow, an idiom) for people who breathe shells.
>
> Yeah, that is probably true. One advantage of the function idiom is that
> it doesn't happen inside single-quotes, so it's one less layer of
> quoting to deal with. And of course it saves a shell invocation. So I
> think mentioning both is reasonable.

As one of those shell-breathing people I prefer the function-style for
its lack of quotes:

git config alias.foo = !foo () { echo $# args: $1, $2 and $3; }; foo

Whlie we're at it, is "sh -c ... -" and "sh -c ... --" equally
portable, I wonder?

>> > +----------------------
>> > +alias.foo = !echo $# args: $1, $2 and $3
>> > +----------------------
>>
>> While I totally agree with the formatting advice you gave here, we may
>> want to avoid this notation; neither "git config alias.foo = !echo ..."
>> nor writing "alias.foo = ..."  in .git/config file would work.
>
> Yeah, I didn't even think about that, but you are right.

Good point, I was wondering about that but decided to take my clue
from existing examples of the same notation...

Right, I'll sleep() on it and cook a patch tomorow, attempting to take
all of the above into account...

-- 
/Lasse
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]