Skip to content

Commit

Permalink
add more options to log graph view
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhs0506 committed Jan 19, 2023
1 parent 6127e48 commit e09747b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
6 changes: 5 additions & 1 deletion pkg/commands/git_commands/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,9 @@ func (self *BranchCommands) Merge(branchName string, opts MergeOpts) error {
}

func (self *BranchCommands) AllBranchesLogCmdObj() oscommands.ICmdObj {
return self.cmd.New(self.UserConfig.Git.AllBranchesLogCmd).DontLog()
self.UserConfig.Git.AllBranchesLogCmd.Idx++
if self.UserConfig.Git.AllBranchesLogCmd.Idx >= len(self.UserConfig.Git.AllBranchesLogCmd.Commands) {
self.UserConfig.Git.AllBranchesLogCmd.Idx = 0
}
return self.cmd.New(self.UserConfig.Git.AllBranchesLogCmd.Commands[self.UserConfig.Git.AllBranchesLogCmd.Idx]).DontLog()
}
23 changes: 17 additions & 6 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type GitConfig struct {
AutoFetch bool `yaml:"autoFetch"`
AutoRefresh bool `yaml:"autoRefresh"`
BranchLogCmd string `yaml:"branchLogCmd"`
AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
AllBranchesLogCmd AllBranchesLogCmdConfig `yaml:"allBranchesLogCmd"`
OverrideGpg bool `yaml:"overrideGpg"`
DisableForcePushing bool `yaml:"disableForcePushing"`
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
Expand All @@ -102,6 +102,11 @@ type MergingConfig struct {
Args string `yaml:"args"`
}

type AllBranchesLogCmdConfig struct {
Idx int `yaml:"idx"`
Commands []string `yaml:"commands"`
}

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
Expand Down Expand Up @@ -398,11 +403,17 @@ func GetDefaultConfig() *UserConfig {
ShowGraph: "when-maximised",
ShowWholeGraph: false,
},
SkipHookPrefix: "WIP",
AutoFetch: true,
AutoRefresh: true,
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",
SkipHookPrefix: "WIP",
AutoFetch: true,
AutoRefresh: true,
BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --",
AllBranchesLogCmd: AllBranchesLogCmdConfig{
Idx: -1,
Commands: []string{
"git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium",
"git log --graph --all --color=always --abbrev-commit --decorate --oneline",
},
},
DisableForcePushing: false,
CommitPrefixes: map[string]CommitPrefixConfig(nil),
ParseEmoji: false,
Expand Down

0 comments on commit e09747b

Please sign in to comment.