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: Giuseppe Scrivano
Subject: Re: [PATCH] Do not limit git-version-gen to work only under the repository root.
Date: Mon, 10 May 2010 12:59:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Bruno, Jim,

thanks for your comments.


Jim Meyering <address@hidden> writes:

> What is your use case?

I have the git repository in myserver/, but the top_srcdir is in
myserver/myserver/.


> 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.

I wasn't aware of this git behaviour.

I couldn't find anything better than the check:

  test -n "$(git log -z -n1 .)"

I am not sure if there is a more "elegant" way to do it.

Cheers,
Giuseppe



>From 5f9409e6b500a74a7f1ad9b46bda5923d0a8b633 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: Modify check whether directory is
controlled by git or not.
---
 ChangeLog                 |    7 +++++++
 build-aux/git-version-gen |    5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5510f68..1dc7fe3 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: Modify check whether directory is
+       controlled by git or not.
+
 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..50646c8 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.10; # UTC
 
 # Copyright (C) 2007-2010 Free Software Foundation, Inc.
 #
@@ -92,7 +92,8 @@ fi
 if test -n "$v"
 then
     : # use $v
-elif test -d .git \
+# Check that the current directory is controlled by git.
+elif (test -n "$(git log -z -n1 .)") > /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]