From 338ebe9e0f1ee0feff01952f8c25bd01b04488d0 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Thu, 6 Feb 2025 07:24:36 +0100 Subject: [PATCH] throw error if search path is not a directroy --- gis | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gis b/gis index b772335..5405741 100755 --- a/gis +++ b/gis @@ -89,6 +89,10 @@ fi # Find Git repositories git_dirs=() for path in "${paths[@]}"; do + # Throw error if search path is not a directory + [ ! -d "$path" ] && error "Search path ${text_bold}${path}${text_reset} is not a directory" + + # Find all Git repositories OLDIFS=$IFS IFS=$'\n' read -r -d '' -a found_git_dirs < <(find "$path" -type d -name ".git" -exec dirname {} \; | sort) IFS=$OLDIFS