From e4d5753bd094cf542f54edbbd58417a5394f5384 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 19 Dec 2018 13:25:07 +0100 Subject: [PATCH] meson-vcs-tag: add work-around for git bug --- meson.build | 2 +- tools/meson-vcs-tag.sh | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 100265570d5..e3641e088c0 100644 --- a/meson.build +++ b/meson.build @@ -584,7 +584,7 @@ endif ##################################################################### vcs_tagger = [meson.source_root() + '/tools/meson-vcs-tag.sh', - '@0@/.git'.format(meson.source_root()), + meson.source_root(), meson.project_version()] sed = find_program('sed') diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh index 9b024c8c288..4345c2145a3 100755 --- a/tools/meson-vcs-tag.sh +++ b/tools/meson-vcs-tag.sh @@ -3,7 +3,10 @@ set -eu set -o pipefail -gitdir="$1" +dir="$1" fallback="$2" -git --git-dir="$gitdir" describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback" +# Apparently git describe has a bug where it always considers the work-tree +# dirty when invoked with --git-dir (even though 'git status' is happy). Work +# around this issue by cd-ing to the source directory. +cd "$dir" && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback" -- 2.39.5