mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
better upstream changes presentation
This commit is contained in:
@ -44,6 +44,10 @@ func (b *Branch) RemoteBranchStoredLocally() bool {
|
||||
return b.IsTrackingRemote() && b.Pushables != "?" && b.Pullables != "?"
|
||||
}
|
||||
|
||||
func (b *Branch) RemoteBranchNotStoredLocally() bool {
|
||||
return b.IsTrackingRemote() && b.Pushables == "?" && b.Pullables == "?"
|
||||
}
|
||||
|
||||
func (b *Branch) MatchesUpstream() bool {
|
||||
return b.RemoteBranchStoredLocally() && b.Pushables == "0" && b.Pullables == "0"
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ func getBranchDisplayStrings(b *models.Branch, fullDescription bool, diffed bool
|
||||
if diffed {
|
||||
nameTextStyle = theme.DiffTerminalColor
|
||||
}
|
||||
|
||||
coloredName := nameTextStyle.Sprint(displayName)
|
||||
if b.IsTrackingRemote() {
|
||||
coloredName = fmt.Sprintf("%s %s", coloredName, ColoredBranchStatus(b, tr))
|
||||
}
|
||||
branchStatus := utils.WithPadding(ColoredBranchStatus(b, tr), 2)
|
||||
coloredName = fmt.Sprintf("%s %s", coloredName, branchStatus)
|
||||
|
||||
recencyColor := style.FgCyan
|
||||
if b.Recency == " *" {
|
||||
@ -77,20 +77,42 @@ func GetBranchTextStyle(name string) style.TextStyle {
|
||||
|
||||
func ColoredBranchStatus(branch *models.Branch, tr *i18n.TranslationSet) string {
|
||||
colour := style.FgYellow
|
||||
if !branch.IsTrackingRemote() || branch.UpstreamGone {
|
||||
if branch.UpstreamGone {
|
||||
colour = style.FgRed
|
||||
} else if branch.MatchesUpstream() {
|
||||
colour = style.FgGreen
|
||||
} else if branch.RemoteBranchNotStoredLocally() {
|
||||
colour = style.FgMagenta
|
||||
}
|
||||
|
||||
return colour.Sprint(BranchStatus(branch, tr))
|
||||
}
|
||||
|
||||
func BranchStatus(branch *models.Branch, tr *i18n.TranslationSet) string {
|
||||
if !branch.IsTrackingRemote() {
|
||||
return ""
|
||||
}
|
||||
|
||||
if branch.UpstreamGone {
|
||||
return tr.UpstreamGone
|
||||
}
|
||||
return fmt.Sprintf("↑%s↓%s", branch.Pushables, branch.Pullables)
|
||||
|
||||
if branch.MatchesUpstream() {
|
||||
return "✓"
|
||||
}
|
||||
if branch.RemoteBranchNotStoredLocally() {
|
||||
return "?"
|
||||
}
|
||||
|
||||
result := ""
|
||||
if branch.HasCommitsToPush() {
|
||||
result = fmt.Sprintf("↑%s", branch.Pushables)
|
||||
}
|
||||
if branch.HasCommitsToPull() {
|
||||
result = fmt.Sprintf("%s↓%s", result, branch.Pullables)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func SetCustomBranches(customBranchColors map[string]string) {
|
||||
|
@ -1077,7 +1077,7 @@ func EnglishTranslationSet() TranslationSet {
|
||||
RewordInEditorPrompt: "Are you sure you want to reword this commit in your editor?",
|
||||
HardResetAutostashPrompt: "Are you sure you want to hard reset to '%s'? An auto-stash will be performed if necessary.",
|
||||
CheckoutPrompt: "Are you sure you want to checkout '%s'?",
|
||||
UpstreamGone: "↑gone",
|
||||
UpstreamGone: "(upstream gone)",
|
||||
Actions: Actions{
|
||||
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
||||
CheckoutCommit: "Checkout commit",
|
||||
|
Reference in New Issue
Block a user