From da384dd7a4eea2fc4153c593026489cee5585895 Mon Sep 17 00:00:00 2001 From: Alex Thiessen Date: Sat, 13 Jan 2018 16:31:28 +0000 Subject: util/release: Improve git worktree checks The bash script `genrelnotes` checks for `.git` to be present to determine whether the current directory is the top directory of a git worktree. 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: I32b06ca982d55fd8e88e55651b6bc53014905823 Signed-off-by: Alex Thiessen Reviewed-on: https://review.coreboot.org/23252 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- util/release/genrelnotes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/release/genrelnotes b/util/release/genrelnotes index 504eda4362..9db86317dc 100755 --- a/util/release/genrelnotes +++ b/util/release/genrelnotes @@ -32,7 +32,8 @@ then exit 1 fi -if [ ! -e ".git" ];then +if ! { cdup="$(git rev-parse --show-cdup 2>/dev/null)" && [ -z "${cdup}" ]; } +then echo "ERROR: This is not the top directory of a git repo. Exiting." exit 1 fi -- cgit v1.2.3