diff options
| author | Matt Hunter <m@lfurio.us> | 2026-02-22 03:06:59 -0500 |
|---|---|---|
| committer | Matt Hunter <m@lfurio.us> | 2026-02-22 22:07:05 -0500 |
| commit | 6c84dee68c857bfbf4a5025c5d3e21c295d6523e (patch) | |
| tree | 59bc1827313bcfb3f4778b462b1468303d832f26 | |
| parent | a2e8081a27cd9be48f0358a720e89a8ae0e4b27a (diff) | |
| download | git-sonar-6c84dee68c857bfbf4a5025c5d3e21c295d6523e.tar.gz git-sonar-6c84dee68c857bfbf4a5025c5d3e21c295d6523e.zip | |
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 <m@lfurio.us>
| -rwxr-xr-x | git-sonar | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -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 } |
