summaryrefslogtreecommitdiffstats
path: root/pkg/gui/presentation/branches.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/presentation/branches.go')
-rw-r--r--pkg/gui/presentation/branches.go58
1 files changed, 32 insertions, 26 deletions
diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go
index 0e48a3935..aab51fe61 100644
--- a/pkg/gui/presentation/branches.go
+++ b/pkg/gui/presentation/branches.go
@@ -155,32 +155,38 @@ func BranchStatus(
return style.FgCyan.Sprintf("%s %s", itemOperationStr, utils.Loader(now, userConfig.Gui.Spinner))
}
- if !branch.IsTrackingRemote() {
- return ""
- }
-
- if branch.UpstreamGone {
- return style.FgRed.Sprint(tr.UpstreamGone)
- }
-
- if branch.MatchesUpstream() {
- return style.FgGreen.Sprint("✓")
- }
- if branch.RemoteBranchNotStoredLocally() {
- return style.FgMagenta.Sprint("?")
- }
-
- if branch.IsBehindForPull() && branch.IsAheadForPull() {
- return style.FgYellow.Sprintf("↓%s↑%s", branch.BehindForPull, branch.AheadForPull)
- }
- if branch.IsBehindForPull() {
- return style.FgYellow.Sprintf("↓%s", branch.BehindForPull)
- }
- if branch.IsAheadForPull() {
- return style.FgYellow.Sprintf("↑%s", branch.AheadForPull)
- }
-
- return ""
+ result := ""
+ if branch.IsTrackingRemote() {
+ if branch.UpstreamGone {
+ result = style.FgRed.Sprint(tr.UpstreamGone)
+ } else if branch.MatchesUpstream() {
+ result = style.FgGreen.Sprint("✓")
+ } else if branch.RemoteBranchNotStoredLocally() {
+ result = style.FgMagenta.Sprint("?")
+ } else if branch.IsBehindForPull() && branch.IsAheadForPull() {
+ result = style.FgYellow.Sprintf("↓%s↑%s", branch.BehindForPull, branch.AheadForPull)
+ } else if branch.IsBehindForPull() {
+ result = style.FgYellow.Sprintf("↓%s", branch.BehindForPull)
+ } else if branch.IsAheadForPull() {
+ result = style.FgYellow.Sprintf("↑%s", branch.AheadForPull)
+ }
+ }
+
+ if userConfig.Gui.ShowDivergenceFromBaseBranch != "none" {
+ behind := branch.BehindBaseBranch.Load()
+ if behind != 0 {
+ if result != "" {
+ result += " "
+ }
+ if userConfig.Gui.ShowDivergenceFromBaseBranch == "arrowAndNumber" {
+ result += style.FgCyan.Sprintf("↓%d", behind)
+ } else {
+ result += style.FgCyan.Sprintf("↓")
+ }
+ }
+ }
+
+ return result
}
func SetCustomBranches(customBranchColors map[string]string) {