From 30a32cce3a16e6c79a81aad467cfe13c12e688cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rousset?= Date: Sun, 13 Dec 2020 22:29:23 +0100 Subject: [PATCH] configure.ac: exclude build without running git (#364) --- configure.ac | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 3468cb1..aadde5b 100644 --- a/configure.ac +++ b/configure.ac @@ -152,15 +152,12 @@ AX_SANITIZERS(, [$default_sanitizers], [AC_DEFINE([I3STATUS_ASAN_ENABLED], [], [ AC_OUTPUT -in_git_worktree=`git rev-parse --is-inside-work-tree 2>/dev/null` -if [ "$in_git_worktree" = "true" ]; then - git_dir=`git rev-parse --git-dir 2>/dev/null` - srcdir=`dirname "$git_dir"` - exclude_dir=`pwd | sed "s,^$srcdir,,g"` - if ! grep -q "^$exclude_dir" "$git_dir/info/exclude"; then - echo "$exclude_dir" >> "$git_dir/info/exclude" - fi -fi +AS_IF([test -d ${srcdir}/.git], [ + srcdir_abs=`readlink -f "$srcdir"` + exclude_dir=`pwd | sed "s,^$srcdir_abs/*,,g"` + AS_IF([! grep -q "^$exclude_dir" "${srcdir}/.git/info/exclude"], + [echo "$exclude_dir" >> "${srcdir}/.git/info/exclude"])]) + echo \ "--------------------------------------------------------------------------------