[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] git-version-gen: include command name in one more diagnostic
From: |
Eric Blake |
Subject: |
Re: [PATCH] git-version-gen: include command name in one more diagnostic |
Date: |
Tue, 04 Jan 2011 07:49:26 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
On 01/04/2011 01:54 AM, Jim Meyering wrote:
> Bruce Korb wrote:
>> On 01/03/11 16:13, Eric Blake wrote:
>>> $ /bin/sh -c 'v=`nonesuch` 2>/dev/null'
>>> nonesuch: not found
>>> $ /bin/sh -c 'v=`(nonesuch) 2>/dev/null`'
>>> $
>>
>> 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.
> @@ -143,7 +143,7 @@ v=`echo "$v" |sed 's/^v//'`
> # Don't declare a version "dirty" merely because a time stamp has changed.
> git update-index --refresh > /dev/null 2>&1
>
> -dirty=`(git diff-index --name-only HEAD) 2>/dev/null` || dirty=
> +dirty=`exec 2>/dev/null; git diff-index --name-only HEAD` || dirty=
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, (continued)
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Bruce Korb, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Jim Meyering, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Ben Pfaff, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Ralf Wildenhues, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Jim Meyering, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Ben Pfaff, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Bruce Korb, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Eric Blake, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Bruce Korb, 2011/01/03
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Jim Meyering, 2011/01/04
- Re: [PATCH] git-version-gen: include command name in one more diagnostic,
Eric Blake <=
- Re: [PATCH] git-version-gen: include command name in one more diagnostic, Bruce Korb, 2011/01/03