From 18903a7dde07a57a023649bf1eb87d3ce77b6347 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 29 Jul 2023 20:36:16 +0200 Subject: [PATCH] Make setCommitMergedStatuses a non-member function It doesn't depend on anything in CommitLoader, so it can be free-standing, and that makes it easier to test (see next commit). --- pkg/commands/git_commands/commit_loader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index f138adfaf..22b92ea0a 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -135,7 +135,7 @@ func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit, } if ancestor != "" { - commits = self.setCommitMergedStatuses(ancestor, commits) + commits = setCommitMergedStatuses(ancestor, commits) } return commits, nil @@ -492,7 +492,7 @@ func (self *CommitLoader) commitFromPatch(content string) *models.Commit { } } -func (self *CommitLoader) setCommitMergedStatuses(ancestor string, commits []*models.Commit) []*models.Commit { +func setCommitMergedStatuses(ancestor string, commits []*models.Commit) []*models.Commit { passedAncestor := false for i, commit := range commits { if strings.HasPrefix(ancestor, commit.Sha) {