Get the SHA1 when no tag is present

The 'git describe' command finds the most recent tag instead of the
SHA1. When trying to build from a repository without any tags, for
example in a fork, this causes the build to fail.

Use the '--always' option to fallback to the SHA1 in case no tag is
present.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
This commit is contained in:
Jef Driesen 2023-10-16 16:57:09 +02:00 committed by Michael Keller
parent e26dd30165
commit 19dd25c71c

View file

@ -177,7 +177,7 @@ if [ "$MXEBUILDTYPE" = "x86_64-w64-mingw32.shared" ] ; then
fi
cd "$BUILDDIR"
CURRENT_SHA=$(cd "$BASEDIR"/subsurface/libdivecomputer ; git describe)
CURRENT_SHA=$(cd "$BASEDIR"/subsurface/libdivecomputer ; git describe --always --long)
PREVIOUS_SHA=$(cat "libdivecomputer.SHA" 2>/dev/null || echo)
if [ ! "$CURRENT_SHA" = "$PREVIOUS_SHA" ] || [ ! -d libdivecomputer ] || [ -f build.libdivecomputer ] ; then
rm -f build.libdivecomputer