summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-11-13 22:14:57 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-11-13 22:25:42 +1100
commit3b1d705473494cca9894ec051d9d928c0c8926c7 (patch)
tree8e6661248e5ab7aced0aee0f68995bb1f57ee398 /pkg/gui/branches_panel.go
parentf43ba728e3206b354d8cb66470fa2a42300c01a8 (diff)
show upstream branch for branch
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r--pkg/gui/branches_panel.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index 23aa17a26..adea31072 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -4,8 +4,10 @@ import (
"fmt"
"strings"
+ "github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
+ "github.com/jesseduffield/lazygit/pkg/utils"
)
// list panel functions
@@ -53,11 +55,15 @@ func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) error {
_ = gui.RenderSelectedBranchUpstreamDifferences()
}()
go func() {
+ upstream, _ := gui.GitCommand.GetUpstreamForBranch(branch.Name)
+ if strings.Contains(upstream, "no upstream configured for branch") {
+ upstream = gui.Tr.SLocalize("notTrackingRemote")
+ }
graph, err := gui.GitCommand.GetBranchGraph(branch.Name)
if err != nil && strings.HasPrefix(graph, "fatal: ambiguous argument") {
graph = gui.Tr.SLocalize("NoTrackingThisBranch")
}
- _ = gui.renderString(g, "main", graph)
+ _ = gui.renderString(g, "main", fmt.Sprintf("%s → %s\n\n%s", utils.ColoredString(branch.Name, color.FgGreen), utils.ColoredString(upstream, color.FgRed), graph))
}()
return nil
}