summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xgit-sonar10
1 files changed, 2 insertions, 8 deletions
diff --git a/git-sonar b/git-sonar
index 06fcf1e..9fd3264 100755
--- a/git-sonar
+++ b/git-sonar
@@ -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