1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

add menu options for log stuff

This commit is contained in:
Jesse Duffield
2021-11-02 21:16:00 +11:00
parent 37be9dbea1
commit ccd80a0e4b
9 changed files with 143 additions and 6 deletions

View File

@ -37,7 +37,12 @@ type CommitListBuilder struct {
}
// NewCommitListBuilder builds a new commit list builder
func NewCommitListBuilder(log *logrus.Entry, gitCommand *GitCommand, osCommand *oscommands.OSCommand, tr *i18n.TranslationSet) *CommitListBuilder {
func NewCommitListBuilder(
log *logrus.Entry,
gitCommand *GitCommand,
osCommand *oscommands.OSCommand,
tr *i18n.TranslationSet,
) *CommitListBuilder {
return &CommitListBuilder{
Log: log,
GitCommand: gitCommand,
@ -88,6 +93,8 @@ type GetCommitsOptions struct {
FilterPath string
IncludeRebaseCommits bool
RefName string // e.g. "HEAD" or "my_branch"
// determines if we show the whole git graph i.e. pass the '--all' flag
All bool
}
func (c *CommitListBuilder) MergeRebasingCommits(commits []*models.Commit) ([]*models.Commit, error) {
@ -407,12 +414,17 @@ func (c *CommitListBuilder) getLogCmd(opts GetCommitsOptions) *exec.Cmd {
config := c.GitCommand.Config.GetUserConfig().Git.Log
orderFlag := "--" + config.Order
allFlag := ""
if opts.All {
allFlag = " --all"
}
return c.OSCommand.ExecutableFromString(
fmt.Sprintf(
"git log %s %s --oneline %s %s --abbrev=%d %s",
"git log %s %s %s --oneline %s %s --abbrev=%d %s",
c.OSCommand.Quote(opts.RefName),
orderFlag,
allFlag,
prettyFormat,
limitFlag,
20,