1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

fetching branches without checking out

This commit is contained in:
Jesse Duffield
2018-12-07 18:52:31 +11:00
parent ca3afa2a39
commit ff856b7630
18 changed files with 224 additions and 132 deletions

View File

@ -1,6 +1,7 @@
package commands
import (
"fmt"
"strings"
"github.com/fatih/color"
@ -10,13 +11,21 @@ import (
// Branch : A git branch
// duplicating this for now
type Branch struct {
Name string
Recency string
Name string
Recency string
Pushables string
Pullables string
Selected bool
}
// GetDisplayStrings returns the dispaly string of branch
func (b *Branch) GetDisplayStrings() []string {
return []string{b.Recency, utils.ColoredString(b.Name, b.GetColor())}
displayName := utils.ColoredString(b.Name, b.GetColor())
if b.Selected && b.Pushables != "" && b.Pullables != "" {
displayName = fmt.Sprintf("↑%s↓%s %s", b.Pushables, b.Pullables, displayName)
}
return []string{b.Recency, displayName}
}
// GetColor branch color