From 9af949b6bd2969dc82a12ef3f143f2b2d446f03b Mon Sep 17 00:00:00 2001 From: Richard Holmboe Date: Wed, 28 Sep 2016 14:48:17 +0200 Subject: Added additional checks for .git and sub-directories. This patch also includes using POSIX native commands and going away from basename/dirname --- radar-base.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/radar-base.sh b/radar-base.sh index a9e3a7f..b5a7df9 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -537,11 +537,17 @@ stashed_status() { } is_cwd_a_dot_git_directory() { - [[ "$(basename $PWD)" == ".git" ]]; return $? + if [[ "${1##*/}" == ".git" ]]; then + return 0 + elif [[ -z $1 ]]; then + return 1 + else + is_cwd_a_dot_git_directory ${1%/*} + fi } stash_status() { - if ! is_cwd_a_dot_git_directory; then + if ! is_cwd_a_dot_git_directory $PWD; then local number_stashes="$(stashed_status)" if [ $number_stashes -gt 0 ]; then printf $PRINT_F_OPTION "${number_stashes}${COLOR_STASH}≡${RESET_COLOR_STASH}" -- cgit v1.2.3