Skip to content

Commit

Permalink
refactor: factors out commit processor.
Browse files Browse the repository at this point in the history
  • Loading branch information
outofcoffee committed Sep 3, 2023
1 parent a9cb006 commit 2bf749b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion vcs/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ func fetchCommitsBetween(
return nil, err
}

tagCommits, err := processCommits(beforeCommit, afterCommit, commits, allTags, unique, excludes)
if err != nil {
return nil, err
}

return tagCommits, nil
}

func processCommits(
beforeCommit *object.Commit,
afterCommit *object.Commit,
commits object.CommitIter,
allTags map[string]*TagMeta,
unique bool,
excludes []*regexp.Regexp,
) (*[]TagCommits, error) {
var tagCommits []TagCommits

currentTag := TagMeta{
Expand Down Expand Up @@ -158,7 +174,7 @@ func fetchCommitsBetween(
// skip commits until reaching beforeTag
skip := beforeCommit != nil

err = commits.ForEach(func(c *object.Commit) error {
err := commits.ForEach(func(c *object.Commit) error {
if beforeCommit != nil && c.Hash == beforeCommit.Hash {
skip = false
}
Expand Down

0 comments on commit 2bf749b

Please sign in to comment.