Rework behind / ahead commit count
This commit is contained in:
parent
09bf6ae01a
commit
349ce73952
14
utils/shgit
14
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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user