6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-10 09:39:20 +00:00

Count commits ahead and behind the upstream branch

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-08 17:16:46 +02:00
parent ee26ddc38f
commit 4765d943ec
5 changed files with 108 additions and 102 deletions

View File

@@ -67,14 +67,14 @@ func printBranchStatus(branch *git.BranchStatus) string {
status = append(status, fmt.Sprintf(ColorYellow, git.StatusNoUpstream))
}
if branch.NeedsPull {
if branch.Behind != 0 {
ok = false
status = append(status, fmt.Sprintf(ColorYellow, git.StatusBehind))
status = append(status, fmt.Sprintf(ColorYellow, fmt.Sprintf("%d %s", branch.Behind, git.StatusBehind)))
}
if branch.NeedsPush {
if branch.Ahead != 0 {
ok = false
status = append(status, fmt.Sprintf(ColorYellow, git.StatusAhead))
status = append(status, fmt.Sprintf(ColorYellow, fmt.Sprintf("%d %s", branch.Ahead, git.StatusAhead)))
}
if ok {