Mercurial > gnulib
changeset 17958:5abf0a6de129
git-version-gen: detect untagged revisions
* build-aux/git-version-gen: If fallback string is empty,
but git is available, use "git describe --always" to extract
a revision, and prefix it with "g". This is much better than
responding "UNKNOWN" and it applies to shallow clones!
author | Mats Erik Andersson <gnu@gisladisker.se> |
---|---|
date | Mon, 13 Apr 2015 23:00:35 +0200 |
parents | 7f3b35eead70 |
children | f34f37b02fc9 |
files | ChangeLog build-aux/git-version-gen |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Apr 14 11:16:47 2015 +0100 +++ b/ChangeLog Mon Apr 13 23:00:35 2015 +0200 @@ -1,3 +1,11 @@ +2015-04-14 Mats Erik Andersson <gnu@gisladisker.se> + + git-version-gen: detect untagged revisions + * build-aux/git-version-gen: If fallback string is empty, + but git is available, use "git describe --always" to extract + a revision, and prefix it with "g". This is much better than + responding "UNKNOWN" and it applies to shallow clones! + 2015-04-14 HIRAMATSU Yoshifumi <hiramatu@boreas.dti.ne.jp> fseeko: fix build failure on NetBSD >= 6 (trivial)
--- a/build-aux/git-version-gen Tue Apr 14 11:16:47 2015 +0100 +++ b/build-aux/git-version-gen Mon Apr 13 23:00:35 2015 +0200 @@ -189,12 +189,16 @@ v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; v_from_git=1 elif test "x$fallback" = x || git --version >/dev/null 2>&1; then - v=UNKNOWN + if v=g`git describe --always HEAD 2>/dev/null`; then + v_from_git=1 + else + v=UNKNOWN + fi else v=$fallback fi -v=`echo "$v" |sed "s/^$prefix//"` +v=`echo "$v" | sed "s/^$prefix//"` # Test whether to append the "-dirty" suffix only if the version # string we're using came from git. I.e., skip the test if it's "UNKNOWN"