bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] Do not limit git-version-gen to work only under the repository r


From: Giuseppe Scrivano
Subject: [PATCH] Do not limit git-version-gen to work only under the repository root.
Date: Mon, 10 May 2010 11:02:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hello,

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?

Cheers,
Giuseppe



>From d059eef04a41ddc8edf62b53ed310359ed1f3a75 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Mon, 10 May 2010 10:58:01 +0200
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.
---
 ChangeLog                 |    7 +++++++
 build-aux/git-version-gen |    4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5510f68..f972043 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-10  Giuseppe Scrivano  <address@hidden>
+
+       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.
+
 2010-05-10  Jim Meyering  <address@hidden>
 
        maint.mk: avoid using a temporary file in the always-defined-macros 
check
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 5a7e989..ac0cacd 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2010-04-26.16; # UTC
+scriptversion=2010-05-10.08; # UTC
 
 # Copyright (C) 2007-2010 Free Software Foundation, Inc.
 #
@@ -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
-- 
1.7.1




reply via email to

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