summaryrefslogtreecommitdiff
path: root/tools/meson-vcs-tag.sh
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-19 13:25:07 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-21 13:43:20 +0100
commite4d5753bd094cf542f54edbbd58417a5394f5384 (patch)
tree4340be32319fec9571589f14b0ec2a2395b6d7f3 /tools/meson-vcs-tag.sh
parent681bd2c524ed71ac04045c90884ba8d55eee7b66 (diff)
downloadsystemd-e4d5753bd094cf542f54edbbd58417a5394f5384.tar.gz
meson-vcs-tag: add work-around for git bug
Diffstat (limited to 'tools/meson-vcs-tag.sh')
-rwxr-xr-xtools/meson-vcs-tag.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh
index 9b024c8c28..4345c2145a 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"