From 340ed6b07878e8c5056e4e97ca090b531078a19a Mon Sep 17 00:00:00 2001 From: arzzen Date: Sun, 6 Oct 2024 14:35:07 +0200 Subject: [PATCH] Fix: show help page when not inside a git repository Ensure the usage function is called to display the help page if the script is not run inside a git repository. #168 --- git-quick-stats | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git-quick-stats b/git-quick-stats index 139b16f..7a579b5 100755 --- a/git-quick-stats +++ b/git-quick-stats @@ -986,7 +986,11 @@ function suggestReviewers() { checkUtils # Check if we are currently in a git repo. -git rev-parse --is-inside-work-tree > /dev/null +if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then + echo "Not inside a git repository." + usage + exit 1 +fi # Parse non-interative commands if [[ "$#" -eq 1 ]]; then