summaryrefslogtreecommitdiff
path: root/util/genbuild_h
diff options
context:
space:
mode:
authorAlex Thiessen <alex.thiessen.de+coreboot@gmail.com>2018-01-14 11:59:47 +0000
committerMartin Roth <martinroth@google.com>2018-01-23 05:33:02 +0000
commit1758fd2a32408b9206c41b8e71300494ee53f886 (patch)
treeb6656976786ca89c4ecd888847e0f5b8272c4e72 /util/genbuild_h
parentff4025c5f789b80e6552dd887c34c34642a98c64 (diff)
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 <alex.thiessen.de+coreboot@gmail.com> Reviewed-on: https://review.coreboot.org/23256 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/genbuild_h')
-rwxr-xr-xutil/genbuild_h/genbuild_h.sh4
1 files changed, 1 insertions, 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)