From 468ade51635524e420e670ef412e75aa93c4a428 Mon Sep 17 00:00:00 2001 From: "Dr. Matthias St. Pierre" Date: Mon, 6 Dec 2021 17:33:29 +0100 Subject: [PATCH] Simplify check for git working tree in 3.0 Sending the entire log to /dev/null is a rather expensive way of checking whether we are inside a git working tree. Use `git rev-parse --is-inside-work-tree` instead. (cherry picked from commit 1e3f9329320028f81e2dfd26b2cb8f01fbba7eb1) --- testssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 1551747..403404a 100755 --- a/testssl.sh +++ b/testssl.sh @@ -122,7 +122,7 @@ declare -r SWCONTACT="dirk aet testssl dot sh" grep -E -q "dev|rc|beta" <<< "$VERSION" && \ SWURL="https://testssl.sh/dev/" || SWURL="https://testssl.sh/" -if git log &>/dev/null; then +if git rev-parse --is-inside-work-tree &>/dev/null; then declare -r GIT_REL="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $1" "$2" "$3 }')" declare -r GIT_REL_SHORT="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $1 }')" declare -r REL_DATE="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $2 }')"