mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
WIP Add showDivergenceFromBaseBranch config
This commit is contained in:
parent
6d2ec43596
commit
4d2177725f
4 changed files with 56 additions and 31 deletions
|
@ -74,6 +74,7 @@ gui:
|
||||||
showListFooter: true # for seeing the '5 of 20' message in list panels
|
showListFooter: true # for seeing the '5 of 20' message in list panels
|
||||||
showRandomTip: true
|
showRandomTip: true
|
||||||
showBranchCommitHash: false # show commit hashes alongside branch names
|
showBranchCommitHash: false # show commit hashes alongside branch names
|
||||||
|
showDivergenceFromBaseBranch: onlyBehind # one of 'off' | 'onlyBehind' | 'behindAndAhead'
|
||||||
showBottomLine: true # for hiding the bottom information line (unless it has important information to tell you)
|
showBottomLine: true # for hiding the bottom information line (unless it has important information to tell you)
|
||||||
showPanelJumps: true # for showing the jump-to-panel keybindings as panel subtitles
|
showPanelJumps: true # for showing the jump-to-panel keybindings as panel subtitles
|
||||||
showCommandLog: true
|
showCommandLog: true
|
||||||
|
|
|
@ -127,6 +127,8 @@ type GuiConfig struct {
|
||||||
CommitHashLength int `yaml:"commitHashLength" jsonschema:"minimum=0"`
|
CommitHashLength int `yaml:"commitHashLength" jsonschema:"minimum=0"`
|
||||||
// If true, show commit hashes alongside branch names in the branches view.
|
// If true, show commit hashes alongside branch names in the branches view.
|
||||||
ShowBranchCommitHash bool `yaml:"showBranchCommitHash"`
|
ShowBranchCommitHash bool `yaml:"showBranchCommitHash"`
|
||||||
|
// Whether to show the divergence from the base branch in the branches view.
|
||||||
|
ShowDivergenceFromBaseBranch string `yaml:"showDivergenceFromBaseBranch" jsonschema:"enum=off,enum=onlyBehind,enum=behindAndAhead"`
|
||||||
// Height of the command log view
|
// Height of the command log view
|
||||||
CommandLogSize int `yaml:"commandLogSize" jsonschema:"minimum=0"`
|
CommandLogSize int `yaml:"commandLogSize" jsonschema:"minimum=0"`
|
||||||
// Whether to split the main window when viewing file changes.
|
// Whether to split the main window when viewing file changes.
|
||||||
|
@ -668,26 +670,27 @@ func GetDefaultConfig() *UserConfig {
|
||||||
UnstagedChangesColor: []string{"red"},
|
UnstagedChangesColor: []string{"red"},
|
||||||
DefaultFgColor: []string{"default"},
|
DefaultFgColor: []string{"default"},
|
||||||
},
|
},
|
||||||
CommitLength: CommitLengthConfig{Show: true},
|
CommitLength: CommitLengthConfig{Show: true},
|
||||||
SkipNoStagedFilesWarning: false,
|
SkipNoStagedFilesWarning: false,
|
||||||
ShowListFooter: true,
|
ShowListFooter: true,
|
||||||
ShowCommandLog: true,
|
ShowCommandLog: true,
|
||||||
ShowBottomLine: true,
|
ShowBottomLine: true,
|
||||||
ShowPanelJumps: true,
|
ShowPanelJumps: true,
|
||||||
ShowFileTree: true,
|
ShowFileTree: true,
|
||||||
ShowRandomTip: true,
|
ShowRandomTip: true,
|
||||||
ShowIcons: false,
|
ShowIcons: false,
|
||||||
NerdFontsVersion: "",
|
NerdFontsVersion: "",
|
||||||
ShowFileIcons: true,
|
ShowFileIcons: true,
|
||||||
CommitHashLength: 8,
|
CommitHashLength: 8,
|
||||||
ShowBranchCommitHash: false,
|
ShowBranchCommitHash: false,
|
||||||
CommandLogSize: 8,
|
ShowDivergenceFromBaseBranch: "onlyBehind",
|
||||||
SplitDiff: "auto",
|
CommandLogSize: 8,
|
||||||
SkipRewordInEditorWarning: false,
|
SplitDiff: "auto",
|
||||||
Border: "rounded",
|
SkipRewordInEditorWarning: false,
|
||||||
AnimateExplosion: true,
|
Border: "rounded",
|
||||||
PortraitMode: "auto",
|
AnimateExplosion: true,
|
||||||
FilterMode: "substring",
|
PortraitMode: "auto",
|
||||||
|
FilterMode: "substring",
|
||||||
Spinner: SpinnerConfig{
|
Spinner: SpinnerConfig{
|
||||||
Frames: []string{"|", "/", "-", "\\"},
|
Frames: []string{"|", "/", "-", "\\"},
|
||||||
Rate: 50,
|
Rate: 50,
|
||||||
|
|
|
@ -172,18 +172,29 @@ func BranchStatus(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ahead := branch.AheadOfBaseBranch.Load()
|
if userConfig.Gui.ShowDivergenceFromBaseBranch != "off" {
|
||||||
behind := branch.BehindBaseBranch.Load()
|
behind := branch.BehindBaseBranch.Load()
|
||||||
if ahead != 0 || behind != 0 {
|
if userConfig.Gui.ShowDivergenceFromBaseBranch == "onlyBehind" {
|
||||||
if result != "" {
|
if behind != 0 {
|
||||||
result += " "
|
if result != "" {
|
||||||
}
|
result += " "
|
||||||
if ahead != 0 && behind != 0 {
|
}
|
||||||
result += style.FgCyan.Sprintf("↓%d↑%d", behind, ahead)
|
result += style.FgCyan.Sprintf("↓%d", behind)
|
||||||
} else if behind != 0 {
|
}
|
||||||
result += style.FgCyan.Sprintf("↓%d", behind)
|
|
||||||
} else {
|
} else {
|
||||||
result += style.FgCyan.Sprintf("↑%d", ahead)
|
ahead := branch.AheadOfBaseBranch.Load()
|
||||||
|
if ahead != 0 || behind != 0 {
|
||||||
|
if result != "" {
|
||||||
|
result += " "
|
||||||
|
}
|
||||||
|
if ahead != 0 && behind != 0 {
|
||||||
|
result += style.FgCyan.Sprintf("↓%d↑%d", behind, ahead)
|
||||||
|
} else if behind != 0 {
|
||||||
|
result += style.FgCyan.Sprintf("↓%d", behind)
|
||||||
|
} else {
|
||||||
|
result += style.FgCyan.Sprintf("↑%d", ahead)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,6 +319,16 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "If true, show commit hashes alongside branch names in the branches view."
|
"description": "If true, show commit hashes alongside branch names in the branches view."
|
||||||
},
|
},
|
||||||
|
"showDivergenceFromBaseBranch": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"off",
|
||||||
|
"onlyBehind",
|
||||||
|
"behindAndAhead"
|
||||||
|
],
|
||||||
|
"description": "Whether to show the divergence from the base branch in the branches view.",
|
||||||
|
"default": "onlyBehind"
|
||||||
|
},
|
||||||
"commandLogSize": {
|
"commandLogSize": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue