From 666180cfd02f7ff69faa7425caa5eef358955827 Mon Sep 17 00:00:00 2001 From: Lay Date: Mon, 30 May 2022 13:52:39 +0800 Subject: [PATCH 1/3] Add config param that displays the whole git graph by default --- docs/Config.md | 2 ++ pkg/config/user_config.go | 2 ++ pkg/gui/context/local_commits_context.go | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index 5e32f3605..11ddb4e1f 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -75,6 +75,8 @@ git: # one of always, never, when-maximised # this determines whether the git graph is rendered in the commits panel showGraph: 'when-maximised' + # displays the whole git graph by default in the commits panel + showWholeGraph: false skipHookPrefix: WIP autoFetch: true autoRefresh: true diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 6ff3b36a1..1e42b0e15 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -106,6 +106,7 @@ type MergingConfig struct { type LogConfig struct { Order string `yaml:"order"` // one of date-order, author-date-order, topo-order ShowGraph string `yaml:"showGraph"` // one of always, never, when-maximised + ShowWholeGraph bool `yaml:"showWholeGraph"` } type CommitPrefixConfig struct { @@ -385,6 +386,7 @@ func GetDefaultConfig() *UserConfig { Log: LogConfig{ Order: "topo-order", ShowGraph: "when-maximised", + ShowWholeGraph: false, }, SkipHookPrefix: "WIP", AutoFetch: true, diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index 7432cab95..6653087c1 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -24,7 +24,7 @@ func NewLocalCommitsContext( c *types.HelperCommon, ) *LocalCommitsContext { - viewModel := NewLocalCommitsViewModel(getModel) + viewModel := NewLocalCommitsViewModel(getModel, c) return &LocalCommitsContext{ LocalCommitsViewModel: viewModel, @@ -70,10 +70,11 @@ type LocalCommitsViewModel struct { showWholeGitGraph bool } -func NewLocalCommitsViewModel(getModel func() []*models.Commit) *LocalCommitsViewModel { +func NewLocalCommitsViewModel(getModel func() []*models.Commit, c *types.HelperCommon) *LocalCommitsViewModel { self := &LocalCommitsViewModel{ BasicViewModel: NewBasicViewModel(getModel), limitCommits: true, + showWholeGitGraph: c.UserConfig.Git.Log.ShowWholeGraph, } return self From b6b3be9ac73c2d352a9128ca9865b0cb1ae6602d Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 30 May 2022 17:34:30 +1000 Subject: [PATCH 2/3] Update docs/Config.md --- docs/Config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Config.md b/docs/Config.md index 11ddb4e1f..134f49600 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -75,7 +75,7 @@ git: # one of always, never, when-maximised # this determines whether the git graph is rendered in the commits panel showGraph: 'when-maximised' - # displays the whole git graph by default in the commits panel + # displays the whole git graph by default in the commits panel (equivalent to passing the `--all` argument to `git log`) showWholeGraph: false skipHookPrefix: WIP autoFetch: true From 684ea284af3482bb0cf573329bec0f4c2707d3e8 Mon Sep 17 00:00:00 2001 From: Lay Date: Mon, 30 May 2022 23:19:48 +0800 Subject: [PATCH 3/3] fix: lint error --- pkg/config/user_config.go | 10 +++++----- pkg/gui/context/local_commits_context.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 1e42b0e15..0b3a91bf6 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -104,9 +104,9 @@ type MergingConfig struct { } type LogConfig struct { - Order string `yaml:"order"` // one of date-order, author-date-order, topo-order - ShowGraph string `yaml:"showGraph"` // one of always, never, when-maximised - ShowWholeGraph bool `yaml:"showWholeGraph"` + Order string `yaml:"order"` // one of date-order, author-date-order, topo-order + ShowGraph string `yaml:"showGraph"` // one of always, never, when-maximised + ShowWholeGraph bool `yaml:"showWholeGraph"` } type CommitPrefixConfig struct { @@ -384,8 +384,8 @@ func GetDefaultConfig() *UserConfig { Args: "", }, Log: LogConfig{ - Order: "topo-order", - ShowGraph: "when-maximised", + Order: "topo-order", + ShowGraph: "when-maximised", ShowWholeGraph: false, }, SkipHookPrefix: "WIP", diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index 6653087c1..9550bcfdb 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -72,8 +72,8 @@ type LocalCommitsViewModel struct { func NewLocalCommitsViewModel(getModel func() []*models.Commit, c *types.HelperCommon) *LocalCommitsViewModel { self := &LocalCommitsViewModel{ - BasicViewModel: NewBasicViewModel(getModel), - limitCommits: true, + BasicViewModel: NewBasicViewModel(getModel), + limitCommits: true, showWholeGitGraph: c.UserConfig.Git.Log.ShowWholeGraph, }