[Top][All Lists]
[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: |
Mon, 10 May 2010 11:40:23 +0200 |
Giuseppe Scrivano wrote:
> I would like to use git-version-gen from a directory that is not the
> repository root, so "test -d .git" is not the proper check.
>
> What about this patch?
Hi Giuseppe,
What is your use case?
Won't this proposal cause trouble when
running git-version-gen in a non-version-controlled
pkg-top-level-directory that has a parent containing an
unrelated .git/ directory?
That would happen to me when building under $HOME,
since I have $HOME/.git.
I think you would have to add something more to ensure that the
repository used is in fact associated with the project at hand.
> Subject: [PATCH] Do not limit git-version-gen to work only under the
> repository root.
>
> * build-aux/git-version-gen: Check if it is a git repository using the
> "git status" command instead of test'ing the .git directory presence.
...
> @@ -92,7 +92,7 @@ fi
> if test -n "$v"
> then
> : # use $v
> -elif test -d .git \
> +elif git describe > /dev/null 2>&1 \
> && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
> || git describe --abbrev=4 HEAD 2>/dev/null` \
> && case $v in