#####################################################################
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')
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"