Hi,
On Mon, Sep 20, 2010 at 8:33 AM, Eric Blake <[email protected]> wrote:
> On 09/20/2010 09:13 AM, Bruce Korb wrote:
>>
>> I took a quick look. The problem is that "git-version-gen" knows
>> that it must be running in the gnulib root directory. If it is not,
>> it just quietly inserts "UNKNOWN" into the output. This script should
>> add this code early on:
>>
>> cd_to_git_root() {
>> test -d .git&& return 0
>> d=`dirname $0`/..
>> test -d $d/.git&& cd $d&& return 0
>> d=`git root`
>> test -d $d/.git&& cd $d&& return 0
>> die "cannot determine git version outside of repo"
>> }
>
> Except that this won't help projects that use git-version-gen inside
> configure.ac to generate the package version number, where the script MUST
> succeed (even if by printing UNKNOWN) so that you can autoreconf the project
> even when outside of a git repository. Furthermore, testing for the
> existence of .git is not the kosher way
Perhaps not, but it currently does that test to determine if
"UNKNOWN" should be emitted. I was merely copying that logic.
In my case, I want to choke over UNKNOWN.
> of determining whether you are
> running from within a git repository, and there is no such command
> as 'git root'.
Sorry. BitKeeper had it and the method for accomplishing it was
too complicated, so I added an alias and forgot I'd done so:
[alias]
root = !pwd -P
There is an approved way, but it is really obtuse:
$(\cd ./$(git rev-parse --show-cdup) && pwd -P)
Far from the first thing that comes to mind.