Add config options for external change detection

Two settings to control the upcoming background polling mechanism:

- git.autoDetectExternalChanges (default true) is the on/off switch, parallel to
  autoFetch/autoRefresh
- refresher.externalChangeCheckInterval (default 2 seconds) is the poll cadence

Disabling is the bool's job, not a magic 0 interval, matching the existing
convention.

Not yet referenced by any code.
This commit is contained in:
Stefan Haller
2026-06-19 18:07:48 +02:00
parent cb12cb2f6b
commit 661df80fe8
4 changed files with 45 additions and 2 deletions
+10
View File
@@ -414,6 +414,11 @@ git:
# If true, periodically refresh files and submodules
autoRefresh: true
# If true, poll the repo periodically for external ref changes (commits, branch
# updates, checkouts made outside lazygit) and refresh when one is detected.
# Independent of autoRefresh, which only governs the files panel.
autoDetectExternalChanges: true
# If not "none", lazygit will automatically fast-forward local branches to match
# their upstream after fetching. Applies to branches that are not the currently
# checked out branch, and only to those that are strictly behind their upstream
@@ -525,6 +530,11 @@ refresher:
# Auto-fetch can be disabled via option 'git.autoFetch'.
fetchInterval: 60
# Interval in seconds at which lazygit polls for external ref changes (commits,
# branch updates, checkouts made outside lazygit).
# Detection can be disabled via option 'git.autoDetectExternalChanges'.
externalChangeCheckInterval: 2
# If true, show a confirmation popup before quitting Lazygit
confirmOnQuit: false
+11
View File
@@ -654,6 +654,12 @@ git:
# If true, periodically refresh files and submodules
autoRefresh: true
# If true, poll the repo periodically for external ref changes (commits,
# branch updates, checkouts made outside lazygit) and refresh when one
# is detected. Independent of autoRefresh, which only governs the files
# panel.
autoDetectExternalChanges: true
# If true, pass the --all arg to git fetch
fetchAll: true
@@ -723,6 +729,11 @@ refresher:
# Auto-fetch can be disabled via option 'git.autoFetch'.
fetchInterval: 60
# Interval in seconds at which lazygit polls for external ref changes
# (commits, branch updates, checkouts made outside lazygit).
# Detection can be disabled via option 'git.autoDetectExternalChanges'.
externalChangeCheckInterval: 2
# If true, show a confirmation popup before quitting Lazygit
confirmOnQuit: false
+13 -2
View File
@@ -48,6 +48,9 @@ type RefresherConfig struct {
// Re-fetch interval in seconds.
// Auto-fetch can be disabled via option 'git.autoFetch'.
FetchInterval int `yaml:"fetchInterval" jsonschema:"exclusiveMinimum=0"`
// Interval in seconds at which lazygit polls for external ref changes (commits, branch updates, checkouts made outside lazygit).
// Detection can be disabled via option 'git.autoDetectExternalChanges'.
ExternalChangeCheckInterval int `yaml:"externalChangeCheckInterval" jsonschema:"exclusiveMinimum=0"`
}
func (c *RefresherConfig) RefreshIntervalDuration() time.Duration {
@@ -58,6 +61,10 @@ func (c *RefresherConfig) FetchIntervalDuration() time.Duration {
return time.Second * time.Duration(c.FetchInterval)
}
func (c *RefresherConfig) ExternalChangeCheckIntervalDuration() time.Duration {
return time.Second * time.Duration(c.ExternalChangeCheckInterval)
}
type GuiConfig struct {
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-author-color
AuthorColors map[string]string `yaml:"authorColors"`
@@ -296,6 +303,8 @@ type GitConfig struct {
AutoFetch bool `yaml:"autoFetch"`
// If true, periodically refresh files and submodules
AutoRefresh bool `yaml:"autoRefresh"`
// If true, poll the repo periodically for external ref changes (commits, branch updates, checkouts made outside lazygit) and refresh when one is detected. Independent of autoRefresh, which only governs the files panel.
AutoDetectExternalChanges bool `yaml:"autoDetectExternalChanges"`
// If not "none", lazygit will automatically fast-forward local branches to match their upstream after fetching. Applies to branches that are not the currently checked out branch, and only to those that are strictly behind their upstream (as opposed to diverged).
// Possible values: 'none' | 'onlyMainBranches' | 'allBranches'
AutoForwardBranches string `yaml:"autoForwardBranches" jsonschema:"enum=none,enum=onlyMainBranches,enum=allBranches"`
@@ -922,6 +931,7 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
MainBranches: []string{"master", "main"},
AutoFetch: true,
AutoRefresh: true,
AutoDetectExternalChanges: true,
AutoForwardBranches: "onlyMainBranches",
FetchAll: true,
AutoStageResolvedConflicts: true,
@@ -937,8 +947,9 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
TruncateCopiedCommitHashesTo: 12,
},
Refresher: RefresherConfig{
RefreshInterval: 10,
FetchInterval: 60,
RefreshInterval: 10,
FetchInterval: 60,
ExternalChangeCheckInterval: 2,
},
Update: UpdateConfig{
Method: "prompt",
+11
View File
@@ -358,6 +358,11 @@
"description": "If true, periodically refresh files and submodules",
"default": true
},
"autoDetectExternalChanges": {
"type": "boolean",
"description": "If true, poll the repo periodically for external ref changes (commits, branch updates, checkouts made outside lazygit) and refresh when one is detected. Independent of autoRefresh, which only governs the files panel.",
"default": true
},
"autoForwardBranches": {
"type": "string",
"enum": [
@@ -3548,6 +3553,12 @@
"exclusiveMinimum": 0,
"description": "Re-fetch interval in seconds.\nAuto-fetch can be disabled via option 'git.autoFetch'.",
"default": 60
},
"externalChangeCheckInterval": {
"type": "integer",
"exclusiveMinimum": 0,
"description": "Interval in seconds at which lazygit polls for external ref changes (commits, branch updates, checkouts made outside lazygit).\nDetection can be disabled via option 'git.autoDetectExternalChanges'.",
"default": 2
}
},
"additionalProperties": false,