Mercurial > gnulib
diff build-aux/git-version-gen @ 13803:112326beb7c3
git-version-gen: do require git-VC'd files in cwd
* build-aux/git-version-gen: Reject a git version string
if there are no commits associated with the current directory.
This avoids an unlikely false-positive (unrelated dir whose parent
repository also contains a tag matching v*), as pointed out
by Giuseppe Scrivano in
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/21843/focus=23664
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Wed, 13 Oct 2010 22:11:31 +0200 |
parents | ffc169da68eb |
children | 97fc9a21a8fb ef8b363d4b54 |
line wrap: on
line diff
--- a/build-aux/git-version-gen Wed Oct 13 20:49:40 2010 -0700 +++ b/build-aux/git-version-gen Wed Oct 13 22:11:31 2010 +0200 @@ -1,6 +1,6 @@ #!/bin/sh # Print a version string. -scriptversion=2010-10-13.14; # UTC +scriptversion=2010-10-13.20; # UTC # Copyright (C) 2007-2010 Free Software Foundation, Inc. # @@ -98,9 +98,10 @@ if test -n "$v" then : # use $v -# Otherwise, if we're anywhere beneath a .git directory, and "git describe" -# output looks sensible, use that to derive a version string. -elif git rev-parse --verify HEAD > /dev/null 2>&1 \ +# Otherwise, if there is at least one git commit involving the working +# directory, and "git describe" output looks sensible, use that to +# derive a version string. +elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \ || git describe --abbrev=4 HEAD 2>/dev/null` \ && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \