Skip to content

Commit 0b98cf0

Browse files
committed
fixup! commits: add incremental git log limit
1 parent a9be3c2 commit 0b98cf0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/commands/git_commands/commit_loader.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,11 @@ func (self *CommitLoader) getLogCmd(opts GetCommitsOptions) *oscommands.CmdObj {
605605
refSpec += "..." + opts.RefToShowDivergenceFrom
606606
}
607607

608+
var limitArg string
609+
if opts.LogLimit != nil {
610+
limitArg = fmt.Sprintf("--max-count=%d", opts.LogLimit.Limit)
611+
}
612+
608613
cmdArgs := NewGitCmd("log").
609614
Arg(refSpec).
610615
ArgIf(gitLogOrder != "default", "--"+gitLogOrder).
@@ -613,7 +618,7 @@ func (self *CommitLoader) getLogCmd(opts GetCommitsOptions) *oscommands.CmdObj {
613618
Arg(prettyFormat).
614619
Arg("--abbrev=40").
615620
ArgIf(opts.FilterAuthor != "", "--author="+opts.FilterAuthor).
616-
ArgIf(opts.LogLimit != nil, fmt.Sprintf("--max-count=%d", opts.LogLimit.Limit)).
621+
ArgIf(limitArg != "", limitArg).
617622
ArgIf(opts.FilterPath != "", "--follow", "--name-status").
618623
Arg("--no-show-signature").
619624
ArgIf(opts.RefToShowDivergenceFrom != "", "--left-right").

0 commit comments

Comments
 (0)