gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 04/04: ci: update version script to work on detached head


From: gnunet
Subject: [gnunet] 04/04: ci: update version script to work on detached head
Date: Tue, 28 Nov 2023 06:20:25 +0100

This is an automated email from the git hooks/post-receive script.

dvn pushed a commit to branch master
in repository gnunet.

commit 9dd915b5a0b59dfa2589ffc7f8e4ce3b60bdeafb
Author: Devan Carpenter <git@dvn.me>
AuthorDate: Mon Nov 27 22:36:51 2023 -0500

    ci: update version script to work on detached head
    
    git version 2.4.4 changed the way rev-parsing worked in a detached head
    state
---
 contrib/ci/jobs/2-deb-package/version.sh       | 19 ++++++++++++-------
 contrib/ci/jobs/5-arm64-deb-package/version.sh | 19 ++++++++++++-------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/contrib/ci/jobs/2-deb-package/version.sh 
b/contrib/ci/jobs/2-deb-package/version.sh
index 74d0099a2..c5b4e395a 100755
--- a/contrib/ci/jobs/2-deb-package/version.sh
+++ b/contrib/ci/jobs/2-deb-package/version.sh
@@ -1,12 +1,17 @@
 #!/bin/sh
 set -ex
 
-git fetch origin $(git rev-parse --abbrev-ref HEAD) --depth=1000 --tags
-RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always --abbrev=0 
HEAD)
-
-commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
-if [ "${commits}" = "0" ]; then
-    git describe --tag HEAD
+BRANCH=$(git name-rev --name-only HEAD)
+if [ -z "${BRANCH}" ]; then
+       exit 1
 else
-    echo $(echo ${RECENT_VERSION_TAG} | cut -d'v' -f2)-${commits}-$(git 
rev-parse --short=8 HEAD)
+        # "Unshallow" our checkout, but only our current branch, and exclude 
the submodules.
+       git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
+       RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always 
--abbrev=0 HEAD)
+       commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
+       if [ "${commits}" = "0" ]; then
+               git describe --tag HEAD
+       else
+               echo $(echo ${RECENT_VERSION_TAG} | sed -r 
's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
+       fi
 fi
diff --git a/contrib/ci/jobs/5-arm64-deb-package/version.sh 
b/contrib/ci/jobs/5-arm64-deb-package/version.sh
index 74d0099a2..c5b4e395a 100755
--- a/contrib/ci/jobs/5-arm64-deb-package/version.sh
+++ b/contrib/ci/jobs/5-arm64-deb-package/version.sh
@@ -1,12 +1,17 @@
 #!/bin/sh
 set -ex
 
-git fetch origin $(git rev-parse --abbrev-ref HEAD) --depth=1000 --tags
-RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always --abbrev=0 
HEAD)
-
-commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
-if [ "${commits}" = "0" ]; then
-    git describe --tag HEAD
+BRANCH=$(git name-rev --name-only HEAD)
+if [ -z "${BRANCH}" ]; then
+       exit 1
 else
-    echo $(echo ${RECENT_VERSION_TAG} | cut -d'v' -f2)-${commits}-$(git 
rev-parse --short=8 HEAD)
+        # "Unshallow" our checkout, but only our current branch, and exclude 
the submodules.
+       git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
+       RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always 
--abbrev=0 HEAD)
+       commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
+       if [ "${commits}" = "0" ]; then
+               git describe --tag HEAD
+       else
+               echo $(echo ${RECENT_VERSION_TAG} | sed -r 
's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
+       fi
 fi

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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