From 3aa68cd3978b880b451cd41ac4f4ee4ff5c4cb2f Mon Sep 17 00:00:00 2001 From: Adrian Dewhurst Date: Fri, 6 Nov 2020 15:41:15 -0500 Subject: [PATCH] version: relax git detection logic git worktrees have a .git file rather than a .git directory, so building in a worktree caused version.sh to generate an error. Signed-off-by: Adrian Dewhurst --- version/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.sh b/version/version.sh index 69582bb2f..3315ec0dc 100755 --- a/version/version.sh +++ b/version/version.sh @@ -12,7 +12,7 @@ case $# in if [ -z "$extra_hash" ]; then # Nothing, empty extra hash is fine. extra_hash="" - elif [ -d "$extra_hash/.git" ]; then + elif [ -e "$extra_hash/.git" ]; then extra_hash=$(cd "$extra_hash" && git describe --always --dirty --exclude '*' --abbrev=200) elif ! expr "$extra_hash" : "^[0-9a-f]*$"; then echo "Invalid extra hash '$extra_hash', must be a git commit hash or path to a git repo" >&2