Skip to content

Commit

Permalink
Merge pull request jesseduffield#1972 from lei4519/feature/display-wh…
Browse files Browse the repository at this point in the history
…ole-graph-by-default
  • Loading branch information
jesseduffield authored Jun 9, 2022
2 parents cdec70c + 684ea28 commit de3114e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (equivalent to passing the `--all` argument to `git log`)
showWholeGraph: false
skipHookPrefix: WIP
autoFetch: true
autoRefresh: true
Expand Down
10 changes: 6 additions & 4 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +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
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 {
Expand Down Expand Up @@ -383,8 +384,9 @@ func GetDefaultConfig() *UserConfig {
Args: "",
},
Log: LogConfig{
Order: "topo-order",
ShowGraph: "when-maximised",
Order: "topo-order",
ShowGraph: "when-maximised",
ShowWholeGraph: false,
},
SkipHookPrefix: "WIP",
AutoFetch: true,
Expand Down
9 changes: 5 additions & 4 deletions pkg/gui/context/local_commits_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewLocalCommitsContext(

c *types.HelperCommon,
) *LocalCommitsContext {
viewModel := NewLocalCommitsViewModel(getModel)
viewModel := NewLocalCommitsViewModel(getModel, c)

return &LocalCommitsContext{
LocalCommitsViewModel: viewModel,
Expand Down Expand Up @@ -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,
BasicViewModel: NewBasicViewModel(getModel),
limitCommits: true,
showWholeGitGraph: c.UserConfig.Git.Log.ShowWholeGraph,
}

return self
Expand Down

0 comments on commit de3114e

Please sign in to comment.