Makefile.inc: Improve git worktree check

`Makefile.inc` checks for `.git` to be present under $(top) to define
the value of $GIT. This check is rather weak and doesn't handle many
edge cases like that of a broken gitfile.

Add a proper `git rev-parse` call to check the condition.

Change-Id: Ifd6da19f13d9f2a9fddb6afd7cb5f16daba2401e
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23254
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Alex Thiessen 2018-01-14 10:38:30 +00:00 committed by Patrick Georgi
parent d1eca65908
commit a90e5ebde4
1 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,8 @@
##
ifneq ($(NOCOMPILE),1)
GIT:=$(shell [ -e "$(top)/.git" ] && command -v git)
GIT:=$(shell git -C "$(top)" rev-parse --git-dir 1>/dev/null 2>&1 \
&& command -v git)
else
GIT:=
endif