diff --git a/utils/shgit b/utils/shgit index ef9210c..8359112 100644 --- a/utils/shgit +++ b/utils/shgit @@ -38,13 +38,13 @@ shgit() [ -n "$(git status --porcelain)" ] && status=${SHGIT_SEP}* commits=$(git rev-list --left-right --count @{upstream}...HEAD \ - 2>/dev/null | { - t= - IFS=" " read -r behind ahead - [ ${behind:-0} -gt 0 ] && t=$t"v$behind" - [ ${ahead:-0} -gt 0 ] && t=$t"^$ahead" - [ -n "$t" ] && printf "%s" "$SHGIT_SEP" "$t" - }) + 2>/dev/null | tr "\t" ^) + if [ -n "$commits" ]; then + commits=v$commits + commits=${commits#v0} + commits=${commits%^0} + commits=${commits:+$SHGIT_SEP$commits} + fi printf "%s%s%s" "$SHGIT_BEGIN" "$name$rb$status$commits" "$SHGIT_END" }