]> git.phdru.name Git - git-scripts.git/commitdiff
Feat(ls-not-pushed): Improve regular expression
authorOleg Broytman <phd@phdru.name>
Mon, 22 Feb 2021 11:12:52 +0000 (14:12 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 22 Feb 2021 11:12:52 +0000 (14:12 +0300)
Lower probability of false positives.

ls-not-pushed

index 8966c5928735b8a69b92ad9d8d866f8031b7ad38..4cbd831713773fad4b39c3cd8ec6c939bffb0bd7 100755 (executable)
@@ -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`