[coreboot-gerrit] Change in coreboot[master]: util/release: Improve git worktree checks

Alex Thiessen (Code Review) gerrit at coreboot.org
Sun Jan 14 00:31:38 CET 2018


Alex Thiessen has uploaded this change for review. ( https://review.coreboot.org/23252


Change subject: util/release: Improve git worktree checks
......................................................................

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 <alex.thiessen+coreboot at gmail.com>
---
M util/release/genrelnotes
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/23252/1

diff --git a/util/release/genrelnotes b/util/release/genrelnotes
index 504eda4..9db8631 100755
--- a/util/release/genrelnotes
+++ b/util/release/genrelnotes
@@ -32,7 +32,8 @@
 	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

-- 
To view, visit https://review.coreboot.org/23252
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I32b06ca982d55fd8e88e55651b6bc53014905823
Gerrit-Change-Number: 23252
Gerrit-PatchSet: 1
Gerrit-Owner: Alex Thiessen <alex.thiessen.de+coreboot at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180113/c76c233b/attachment.html>


More information about the coreboot-gerrit mailing list