Skip to content

Commit

Permalink
fixing commit logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinAbro321 committed Mar 18, 2024
1 parent f4f068a commit 1d04ee2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package main

import (
"errors"
"fmt"
"os"
"path/filepath"
Expand All @@ -14,6 +15,7 @@ import (
git "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/storer"
"golang.org/x/mod/modfile"
)

Expand Down Expand Up @@ -133,16 +135,17 @@ func getCommitMessagesFromLastTag(lastTagVersion *semver.Version, module string)
}

var commitMessages []string
// These commits are in the order of most recent first
err = commits.ForEach(func(c *object.Commit) error {
if c.Hash == tagCommit.Hash {
// Once we reach the tag's commit, stop iterating
return nil
return storer.ErrStop
}
commitMessages = append(commitMessages, c.Message)
return nil
})

if err != nil {
if err != nil && !errors.Is(err, storer.ErrStop) {
return nil, fmt.Errorf("could not iterate over commits %w", err)
}

Expand Down

0 comments on commit 1d04ee2

Please sign in to comment.