mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 04:45:47 +02:00
config: Add option 'git.autoRefresh' to en-/disable auto-refresh
Adds a new 'autoRefresh' option to the 'git' config section that allows user to disable auto-refresh (defaults to on). If auto-refresh is enabled, the refreshInterval is now checked before starting the timer to prevent crashes when it is non-positive. Fixes #1417
This commit is contained in:
parent
51baa8c17d
commit
240483953f
3 changed files with 14 additions and 2 deletions
|
@ -73,6 +73,7 @@ git:
|
||||||
showGraph: 'when-maximised'
|
showGraph: 'when-maximised'
|
||||||
skipHookPrefix: WIP
|
skipHookPrefix: WIP
|
||||||
autoFetch: true
|
autoFetch: true
|
||||||
|
autoRefresh: true
|
||||||
branchLogCmd: 'git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --'
|
branchLogCmd: 'git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --'
|
||||||
allBranchesLogCmd: 'git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium'
|
allBranchesLogCmd: 'git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium'
|
||||||
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
|
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
|
||||||
|
@ -84,7 +85,7 @@ os:
|
||||||
editCommandTemplate: '{{editor}} {{filename}}'
|
editCommandTemplate: '{{editor}} {{filename}}'
|
||||||
openCommand: ''
|
openCommand: ''
|
||||||
refresher:
|
refresher:
|
||||||
refreshInterval: 10 # file/submodule refresh interval in seconds
|
refreshInterval: 10 # File/submodule refresh interval in seconds. Auto-refresh can be disabled via option 'git.autoRefresh'.
|
||||||
fetchInterval: 60 # re-fetch interval in seconds
|
fetchInterval: 60 # re-fetch interval in seconds
|
||||||
update:
|
update:
|
||||||
method: prompt # can be: prompt | background | never
|
method: prompt # can be: prompt | background | never
|
||||||
|
|
|
@ -68,6 +68,7 @@ type GitConfig struct {
|
||||||
Merging MergingConfig `yaml:"merging"`
|
Merging MergingConfig `yaml:"merging"`
|
||||||
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
||||||
AutoFetch bool `yaml:"autoFetch"`
|
AutoFetch bool `yaml:"autoFetch"`
|
||||||
|
AutoRefresh bool `yaml:"autoRefresh"`
|
||||||
BranchLogCmd string `yaml:"branchLogCmd"`
|
BranchLogCmd string `yaml:"branchLogCmd"`
|
||||||
AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
|
AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
|
||||||
OverrideGpg bool `yaml:"overrideGpg"`
|
OverrideGpg bool `yaml:"overrideGpg"`
|
||||||
|
@ -373,6 +374,7 @@ func GetDefaultConfig() *UserConfig {
|
||||||
},
|
},
|
||||||
SkipHookPrefix: "WIP",
|
SkipHookPrefix: "WIP",
|
||||||
AutoFetch: true,
|
AutoFetch: true,
|
||||||
|
AutoRefresh: true,
|
||||||
BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --",
|
BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --",
|
||||||
AllBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium",
|
AllBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium",
|
||||||
DisableForcePushing: false,
|
DisableForcePushing: false,
|
||||||
|
|
|
@ -587,7 +587,16 @@ func (gui *Gui) Run(filterPath string) error {
|
||||||
go utils.Safe(gui.startBackgroundFetch)
|
go utils.Safe(gui.startBackgroundFetch)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.goEvery(time.Second*time.Duration(userConfig.Refresher.RefreshInterval), gui.stopChan, gui.refreshFilesAndSubmodules)
|
if userConfig.Git.AutoRefresh {
|
||||||
|
refreshInterval := userConfig.Refresher.RefreshInterval
|
||||||
|
if refreshInterval > 0 {
|
||||||
|
gui.goEvery(time.Second*time.Duration(refreshInterval), gui.stopChan, gui.refreshFilesAndSubmodules)
|
||||||
|
} else {
|
||||||
|
gui.c.Log.Errorf(
|
||||||
|
"Value of config option 'refresher.refreshInterval' (%d) is invalid, disabling auto-refresh",
|
||||||
|
refreshInterval)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gui.c.Log.Info("starting main loop")
|
gui.c.Log.Info("starting main loop")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue