From 6c84dee68c857bfbf4a5025c5d3e21c295d6523e Mon Sep 17 00:00:00 2001 From: Matt Hunter Date: Sun, 22 Feb 2026 03:06:59 -0500 Subject: Remove is_cwd_a_dot_git_directory check during stash status All active code is now contained within an outer is_repo() check. This prevents execution inside .git directories or bare git repositories. Remove this redundant check. Signed-off-by: Matt Hunter --- git-sonar | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/git-sonar b/git-sonar index 09d2b93..1978856 100755 --- a/git-sonar +++ b/git-sonar @@ -420,23 +420,11 @@ stashed_status() { printf '%s' "$(git stash list | wc -l 2>/dev/null | grep -oEi '[0-9][0-9]*')" } -is_cwd_a_dot_git_directory() { - 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 "$PWD"; then - local number_stashes - number_stashes="$(stashed_status)" - if [ "$number_stashes" -gt 0 ]; then - printf $PRINT_F_OPTION "${number_stashes}${COLOR_STASH}≡${RESET_COLOR_STASH}" - fi + local number_stashes + number_stashes="$(stashed_status)" + if [ "$number_stashes" -gt 0 ]; then + printf $PRINT_F_OPTION "${number_stashes}${COLOR_STASH}≡${RESET_COLOR_STASH}" fi } -- cgit v1.2.3