From 1758fd2a32408b9206c41b8e71300494ee53f886 Mon Sep 17 00:00:00 2001 From: Alex Thiessen Date: Sun, 14 Jan 2018 11:59:47 +0000 Subject: [PATCH] util/genbuild_h: Add gitfile support `genbuild_h.sh` checks whether it is running from a coreboot's own git worktree to decide whether to use git as the time source. This check fails when `${top}/.git` is a gitfile, e.g. when coreboot is a submodule. Add a proper `git rev-parse` call to check the condition, remove `$top` which is not used anymore. Change-Id: I8bb13d607a01f4f28fa8b165769e0a1f702da362 Signed-off-by: Alex Thiessen Reviewed-on: https://review.coreboot.org/23256 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/genbuild_h/genbuild_h.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh index dfbfca55dc..95846ceae6 100755 --- a/util/genbuild_h/genbuild_h.sh +++ b/util/genbuild_h/genbuild_h.sh @@ -22,13 +22,11 @@ export LANG=C export LC_ALL=C export TZ=UTC0 -top=`dirname $0`/../.. - if [ "${BUILD_TIMELESS}" = "1" ]; then GITREV=Timeless TIMESOURCE="fixed" DATE=0 -elif GIT_DIR="${top}/.git" git status > /dev/null 2>&1; then +elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then GITREV=$(LANG= git log -1 --format=format:%h) TIMESOURCE=git DATE=$(git log --pretty=format:%ct -1)