diff options
author | Patrick Georgi <pgeorgi@google.com> | 2017-10-19 03:45:25 -0400 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2017-10-20 09:40:09 +0000 |
commit | 44aaf6137d0e000d6a83ca036aad5722b485d716 (patch) | |
tree | 820cb605c84d59e6dd97d2aaa8fe1aa92d89265b /util/genbuild_h | |
parent | fe84292eeb0ccc2b436d3c20c598aac0dec5d4fd (diff) | |
download | coreboot-44aaf6137d0e000d6a83ca036aad5722b485d716.tar.xz |
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 <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/22107
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/genbuild_h')
-rwxr-xr-x | util/genbuild_h/genbuild_h.sh | 2 |
1 files changed, 1 insertions, 1 deletions
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) |