From 687bae48ed2370295e40964081684fd875a90b20 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 11 Jun 2024 14:45:51 +0200 Subject: [PATCH] Simplify the MergeRebasingCommits call in GetCommits (slightly) MergeRebasingCommits already merges the rebasing commits into the commits slice that is passed in, so it doesn't make sense to append the result to commits again. It isn't a problem, but only because commits is always empty. --- pkg/commands/git_commands/commit_loader.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 670a14127..bffe4a9fb 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -71,15 +71,13 @@ type GetCommitsOptions struct { // GetCommits obtains the commits of the current branch func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit, error) { commits := []*models.Commit{} - var rebasingCommits []*models.Commit if opts.IncludeRebaseCommits && opts.FilterPath == "" { var err error - rebasingCommits, err = self.MergeRebasingCommits(commits) + commits, err = self.MergeRebasingCommits(commits) if err != nil { return nil, err } - commits = append(commits, rebasingCommits...) } wg := sync.WaitGroup{}