From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: git-version-gen: add support for empty release commits
Date: Sat, 11 May 2019 00:31:16 +0200 [thread overview]
Message-ID: <2373843.TifzBPfD2j@omega> (raw)
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 <bruno@clisp.org>
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]*) ;;
next reply other threads:[~2019-05-10 22:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-10 22:31 Bruno Haible [this message]
2019-05-10 23:13 ` git-version-gen: add support for empty release commits Paul Eggert
2019-05-11 8:55 ` Dmitry V. Levin
2019-05-11 11:46 ` Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2373843.TifzBPfD2j@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).