From: Oleg Broytman Date: Mon, 22 Feb 2021 11:12:52 +0000 (+0300) Subject: Feat(ls-not-pushed): Improve regular expression X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=9a73fd795453b874efe7da629d6954ba05774503;p=git-scripts.git Feat(ls-not-pushed): Improve regular expression Lower probability of false positives. --- diff --git a/ls-not-pushed b/ls-not-pushed index 8966c59..4cbd831 100755 --- a/ls-not-pushed +++ b/ls-not-pushed @@ -1,5 +1,5 @@ #! /bin/sh -if git branch --verbose | grep -q "ahead\|behind"; then +if git branch --verbose | grep -q "\(ahead\|behind\) [0-9]"; then up=`git rev-parse --abbrev-ref @{u} 2>/dev/null` if [ -n "$up" -a "$up" != "@{u}" ]; then set -- `git rev-list --count --left-right @{u}...HEAD`