Another mkgitver tweak & mention it in NEWS.
authorWayne Davison <wayne@opencoder.net>
Tue, 16 Aug 2022 15:38:58 +0000 (08:38 -0700)
committerWayne Davison <wayne@opencoder.net>
Tue, 16 Aug 2022 15:56:36 +0000 (08:56 -0700)
NEWS.md
mkgitver

diff --git a/NEWS.md b/NEWS.md
index 8b9624a2260e3d4776983798e5549b25b7327690..2196c33ca67dac9f0954b438e9d2b90c3420db79 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -8,7 +8,14 @@
   args.
 
 - Fixed a bug in the internal MD4 checksum code that could cause the digest
-  to be incorrect part of the time (the openssl version was/is fine).
+  to be sporadically incorrect (the openssl version was/is fine).
+
+### PACKAGING RELATED:
+
+- The mkgitver script now makes sure that a `.git` dir/file is in the top-level
+  source dir before calling `git describe`. It also runs a basic check on the
+  version value. This should avoid using an unrelated git description for
+  rsync's version.
 
 ------------------------------------------------------------------------------
 
index 43156c652a801ea25604bf4497b4660f3219deb9..fe8a3d1591a80fcae89bd34b41f154497b7cac5c 100755 (executable)
--- a/mkgitver
+++ b/mkgitver
@@ -2,16 +2,13 @@
 
 srcdir=`dirname $0`
 
-if [ -e "$srcdir/.git" ]; then
-    gitver=`git describe --abbrev=8 2>/dev/null`
-fi
-
 if [ ! -f git-version.h ]; then
     touch git-version.h
 fi
 
-case "$gitver" in
-    *.*)
+if [ -e "$srcdir/.git" ]; then
+    gitver=`git describe --abbrev=8 2>/dev/null | sed -n '/^v3\.[0-9][0-9]*\.[0-9][0-9]*\(-\|$\)/p'`
+    if [ -n "$gitver" ]; then
        echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h.new
        if ! diff git-version.h.new git-version.h >/dev/null; then
            echo "Updating git-version.h"
@@ -19,5 +16,5 @@ case "$gitver" in
        else
            rm git-version.h.new
        fi
-       ;;
-esac
+    fi
+fi