From: Zbigniew Jędrzejewski-Szmek Date: Wed, 19 Dec 2018 12:25:07 +0000 (+0100) Subject: meson-vcs-tag: add work-around for git bug X-Git-Tag: v241-rc1~131^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4d5753bd094cf542f54edbbd58417a5394f5384;p=thirdparty%2Fsystemd.git meson-vcs-tag: add work-around for git bug --- 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"