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}*
|
[ -n "$(git status --porcelain)" ] && status=${SHGIT_SEP}*
|
||||||
|
|
||||||
commits=$(git rev-list --left-right --count @{upstream}...HEAD \
|
commits=$(git rev-list --left-right --count @{upstream}...HEAD \
|
||||||
2>/dev/null | {
|
2>/dev/null | tr "\t" ^)
|
||||||
t=
|
if [ -n "$commits" ]; then
|
||||||
IFS=" " read -r behind ahead
|
commits=v$commits
|
||||||
[ ${behind:-0} -gt 0 ] && t=$t"v$behind"
|
commits=${commits#v0}
|
||||||
[ ${ahead:-0} -gt 0 ] && t=$t"^$ahead"
|
commits=${commits%^0}
|
||||||
[ -n "$t" ] && printf "%s" "$SHGIT_SEP" "$t"
|
commits=${commits:+$SHGIT_SEP$commits}
|
||||||
})
|
fi
|
||||||
|
|
||||||
printf "%s%s%s" "$SHGIT_BEGIN" "$name$rb$status$commits" "$SHGIT_END"
|
printf "%s%s%s" "$SHGIT_BEGIN" "$name$rb$status$commits" "$SHGIT_END"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user