bug-gnulib
[Top][All Lists]
Advanced

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

Re: git commit -a -m'avoid an unnecessary sub-shell'


From: Jim Meyering
Subject: Re: git commit -a -m'avoid an unnecessary sub-shell'
Date: Tue, 04 Jan 2011 19:12:19 +0100

Bruce Korb wrote:
>> On 01/04/2011 01:54 AM, Jim Meyering wrote:
>>>> Just for grins, how about trying:
>>>>
>>>> /bin/sh -c 'v=`exec 2>/dev/null;nonesuch`'
>>>>
>>>> I think it works for me on a Sun box:
>>
>> It also works on FreeBSD.
>>
>>> Good idea.  Avoiding an unnecessary sub-shell is always welcome.
>>> I'll wait for your "ok".
>>
>> Looks good to me.  We've already got one sub-shell (the ``), so avoiding
>> the second (the ()) is indeed nicer, and here the exec trick works
>> precisely because it only affects the `` subshell.
>
> Done and pushed.  Thanks.

Hmm... I see you didn't push the same commit I suggested.
It's a good policy to prefix the one-line summary with "module-name: ",
and I had left a space after the semicolon.

>From 67c47b3ef9ac9e8929fc77189c6c8234f8662720 Mon Sep 17 00:00:00 2001
From: Bruce Korb <address@hidden>
Date: Tue, 4 Jan 2011 09:33:27 -0800
Subject: [PATCH] avoid an unnecessary sub-shell
...

-dirty=`(git diff-index --name-only HEAD) 2>/dev/null` || dirty=
+dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=



reply via email to

[Prev in Thread] Current Thread [Next in Thread]