bug-gnulib
[Top][All Lists]
Advanced

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

git-version-gen: add support for empty release commits


From: Bruno Haible
Subject: git-version-gen: add support for empty release commits
Date: Sat, 11 May 2019 00:31:16 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-145-generic; KDE/5.18.0; x86_64; ; )

Hi,

I'm using git-version-gen in GNU gettext. For the 0.20 release, I
created an empty commit, like this:

    CURRENT_VERSION=0.20
    git commit --allow-empty -m "Release $CURRENT_VERSION"
    git tag v$CURRENT_VERSION

Now, git-version-gen ignores this release commit:

$ git describe --abbrev=4 --match="v*" HEAD
v0.19.8.1-519-g62b2a

$ git describe --abbrev=4 --match="v*" --debug HEAD
searching to describe HEAD
finished search at c737bf843616ca984c9416048a2da845e9ad3f50
 annotated        519 v0.19.8.1
traversed 520 commits
v0.19.8.1-519-g62b2a

The fix is to add a --tags option to the 'git describe' command:

$ git describe --abbrev=4 --tags --match="v*" HEAD
v0.20-4-g62b2a

$ git describe --abbrev=4 --tags --match="v*" --debug HEAD
searching to describe HEAD
finished search at c737bf843616ca984c9416048a2da845e9ad3f50
 lightweight        4 v0.20
 annotated        519 v0.19.8.1
traversed 520 commits
v0.20-4-g62b2a

Therefore here's the proposed fix:


2019-05-10  Bruno Haible  <address@hidden>

        git-version-gen: Add support for empty release commits.
        * build-aux/git-version-gen: Invoke 'git describe' with option --tags.

diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 45b5656..5e0e0dd 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -156,8 +156,8 @@ then
 # 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="$prefix*" HEAD 2>/dev/null \
-          || git describe --abbrev=4 HEAD 2>/dev/null` \
+    && v=`git describe --abbrev=4 --tags --match="$prefix*" HEAD 2>/dev/null \
+          || git describe --abbrev=4 --tags HEAD 2>/dev/null` \
     && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
     && case $v in
          $prefix[0-9]*) ;;




reply via email to

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