From: Lasse Makholm Date: Tue, 22 Mar 2011 22:22:04 GMT Subject: Re: Weird behavior of shell variables in git aliases Message-ID: In-Reply-To: <20110322183201.GA22534@sigill.intra.peff.net> On 22 March 2011 19:32, Jeff King 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 -" 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