From 47837163c24f5b88b2194fa92ef86e767b409258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 22 Aug 2021 21:44:20 -0500 Subject: fix if a bash variable is null --- hyperterm/core/git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hyperterm/core/git.sh') diff --git a/hyperterm/core/git.sh b/hyperterm/core/git.sh index 6cf9854..881df2e 100644 --- a/hyperterm/core/git.sh +++ b/hyperterm/core/git.sh @@ -150,7 +150,7 @@ ___upstream="$(git rev-parse --symbolic-full-name --abbrev-ref "@{upstream}" 2> function _git_behind_count() { local __behind_count - if [[ -s $___upstream ]]; then + if [[ ! -z $___upstream ]]; then __behind_count="$(git rev-list --left-right --count "$___upstream"...HEAD | cut -f1 2> /dev/null)" case $__behind_count in 0) echo -n '';; @@ -161,7 +161,7 @@ function _git_behind_count() { function _git_ahead_count() { local __ahead_count - if [[ -s $___upstream ]]; then + if [[ ! -z $___upstream ]]; then __ahead_count="$(git rev-list --left-right --count "$___upstream"...HEAD | cut -f2 2> /dev/null)" case $__ahead_count in 0) echo -n '';; -- cgit v1.2.3