From 44aaf6137d0e000d6a83ca036aad5722b485d716 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 19 Oct 2017 03:45:25 -0400 Subject: util/genbuild_h: improve robustness against corrupt .git directories The new test lets git check if $top is actually a git repo, instead of just looking for clues. BUG=chromium:776174 BRANCH=none TEST=`mv .git .foo; mkdir .git; util/genbuild_h/genbuild_h.sh` provides a valid build.h instead of failing because git is unhappy about the .git directory. Change-Id: I7fcc64d66e0b59fca1479b4c142fd0559aa984f4 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/22107 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Martin Roth --- util/genbuild_h/genbuild_h.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/genbuild_h/genbuild_h.sh') diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh index 3575ad4c35..dfbfca55dc 100755 --- a/util/genbuild_h/genbuild_h.sh +++ b/util/genbuild_h/genbuild_h.sh @@ -28,7 +28,7 @@ if [ "${BUILD_TIMELESS}" = "1" ]; then GITREV=Timeless TIMESOURCE="fixed" DATE=0 -elif [ -e "${top}/.git" -a -x "$(command -v git)" ]; then +elif GIT_DIR="${top}/.git" git status > /dev/null 2>&1; then GITREV=$(LANG= git log -1 --format=format:%h) TIMESOURCE=git DATE=$(git log --pretty=format:%ct -1) -- cgit v1.2.3