Hi GNUNet devs!

I found an issue where VERSION and PACKAGE_VERSION would always be set to 'unknown' if gnunet was cloned as a git submodule.

Steps to repro:

mkdir superproject
cd superproject
git init
git submodule addhttps://git.gnunet.org/gnunet.git
cd gnunet
contrib/get_version.sh

At this point, 'unknown' will print if this is still an issue.

With the attached fix, '0.19.2-6-gbe0ba43d7' will print.


--

Regards,
Dan Church
🌎 web: h3xx.codeberg.page <https://h3xx.codeberg.page/>
"If I am to be judged by those who come after me, let me be judged for the truth." — Raistlin Majere
From 553d5461c8f7730bccab9655ae738544880573f5 Mon Sep 17 00:00:00 2001
From: Dan Church <amphetamach...@gmail.com>
Date: Mon, 9 Jan 2023 13:53:47 -0600
Subject: [PATCH] Fix git detection when cloned as submodule

---
 contrib/get_version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/get_version.sh b/contrib/get_version.sh
index 7366c6bf6..6e3ab5141 100755
--- a/contrib/get_version.sh
+++ b/contrib/get_version.sh
@@ -5,7 +5,7 @@ if test -f ".version"
 then
   VERSION=$(cat .version)
 fi
-if test -d "./.git"
+if [ -e ./.git ]
 then
   VERSION=$(git describe --tags)
   VERSION=${VERSION#v}
-- 
2.39.0

Reply via email to