diff options
| -rwxr-xr-x | git-sonar | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -114,13 +114,6 @@ determine_default_branch() { done } -line_count() { - # macos 'wc' produces odd formatting (extra spaces) - # The grep is present to deal with this, filter out cases where the count - # is zero, and provide a return value (true if count is non-zero). - wc -l 2>/dev/null | grep -oE '[1-9][0-9]*' -} - print_commit_range() { if [ -n "$1" ] && [ -n "$2" ]; then ahead="$(git rev-list --count "${1}..${2}" 2>/dev/null)" || ahead="0" @@ -166,7 +159,8 @@ element_local() { element_stash() { if [ -n "$opt_stash" ]; then - if cnt="$(git stash list | line_count)"; then + cnt="$(git rev-list --walk-reflogs --ignore-missing --count refs/stash)" + if [ "$cnt" -ne 0 ]; then printf '%s%b%b' "$cnt" "$STASH_ICON" "$COLOR_DEF" fi fi |
