Skip to content

Commit 468ade5

Browse files
committed
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 1e3f932)
1 parent 6a00a60 commit 468ade5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

testssl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ declare -r SWCONTACT="dirk aet testssl dot sh"
122122
grep -E -q "dev|rc|beta" <<< "$VERSION" && \
123123
SWURL="https://testssl.sh/dev/" ||
124124
SWURL="https://testssl.sh/"
125-
if git log &>/dev/null; then
125+
if git rev-parse --is-inside-work-tree &>/dev/null; then
126126
declare -r GIT_REL="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $1" "$2" "$3 }')"
127127
declare -r GIT_REL_SHORT="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $1 }')"
128128
declare -r REL_DATE="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $2 }')"

0 commit comments

Comments
 (0)