From 11e0e56489465f9e3a534acdc2ed09bd99641e8d Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Sat, 4 Jun 2022 18:34:04 +0930 Subject: [PATCH] potentially finished git status script for bash prompt --- scripts/bash-status-git | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/bash-status-git b/scripts/bash-status-git index 0c5d0e1..4c2d614 100755 --- a/scripts/bash-status-git +++ b/scripts/bash-status-git @@ -7,9 +7,11 @@ if git status &>/dev/null; then to_push=${counts[0]} to_pull=${counts[1]} + extras=$([[ ${counts[0]} -eq 0 && ${counts[1]} -eq 0 ]] || echo " $to_push↑ $to_pull↓") + if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then - echo "($branch* $to_push↑ $to_pull↓)" + echo "($branch*$extras)" else - echo "($branch~ $to_push↑ $to_pull↓)" + echo "($branch~$extras)" fi fi