From 73f19dca386d775a880bdc945efaa6b9c77d9e94 Mon Sep 17 00:00:00 2001 From: Alex Thiessen Date: Tue, 16 Jan 2018 23:05:48 +0000 Subject: util/lint: Unify checks for git worktree Linters try to determine whether they are running in a git worktree so that `git grep` can be used instead of `grep`. These checks are done in different not truly correct ways and thus the linters don't use `git grep` when running from a worktree subdirectory, e.g. in a git subtree environment. Unify checks using `git rev-parse --is-inside-work-tree`. Change-Id: I3f54afc99ad0f0e3052cffdd32bdd9649cf3d720 Signed-off-by: Alex Thiessen Reviewed-on: https://review.coreboot.org/23297 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/lint/lint-stable-013-site-local | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'util/lint/lint-stable-013-site-local') diff --git a/util/lint/lint-stable-013-site-local b/util/lint/lint-stable-013-site-local index 43c4542a04..d701ee07b3 100755 --- a/util/lint/lint-stable-013-site-local +++ b/util/lint/lint-stable-013-site-local @@ -22,7 +22,9 @@ LC_ALL=C export LC_ALL -if [ -n "$(command -v git)" ] && [ -e ".git" ]; then +if [ -n "$(command -v git)" ] && \ + [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] +then if [ -n "$(git ls-files site-local/*)" ]; then echo "Error: site-local must be kept separate from the coreboot repository." fi -- cgit v1.2.3