bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] Do not limit git-version-gen to work only under the reposito


From: Jim Meyering
Subject: Re: [PATCH] Do not limit git-version-gen to work only under the repository root.
Date: Wed, 13 Oct 2010 18:28:33 +0200

Giuseppe Scrivano wrote:

> Hello,
>
> Jim Meyering <address@hidden> writes:
>
>> Not sure about more "elegant", but here's a lower cost method:
>
> Thanks for the patch but I think the problem you have reported here:
>
>   http://article.gmane.org/gmane.comp.lib.gnulib.bugs/21845
>
> persists.
>
>
> Here an example, where /tmp/foo is a git repository.
>
> /tmp/foo$ mkdir bar && cd bar && git rev-parse --verify HEAD
> eed6a47d30bff7fd268411ae8a0d893c3827edc1
> /tmp/foo/bar$
>
>
> Instead, using the more expensive "git log", you are sure the directory
> is controlled by git:
>
> /tmp/foo$ (test -n "$(git log -z -n1 .)") > /dev/null 2>&1 && echo FOO
> FOO
>
> /tmp/foo$ mkdir bar && cd bar \
>           && (test -n "$(git log -z -n1 .)") > /dev/null 2>&1 && echo BAR
> /tmp/foo/bar$

Hi Giuseppe,

Thanks for pointing that out.

In that case, this should be a little better:
[I didn't see a need for your -z, and --pretty=format:x
simply avoids printing out unnecessary information.
Also, I didn't see a need for the outer subshell, so removed it. ]

    test -n "$(git log -1 --pretty=format:x . 2>/dev/null)"

>> * build-aux/git-version-gen: Adjust this script so that it works
>> when run from any working directory beneath the top-level .git/-
>> containing directory.  Inspired by a patch from Giusseppe Scrivano,
>> http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/21843/focus=21847
>
> oops, typo in my name.

Sorry about that.
I'll correct the ChangeLog entry.



reply via email to

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