Skip to content

Commit

Permalink
Merge pull request #110 from smlx/export
Browse files Browse the repository at this point in the history
Export function NextVersion
  • Loading branch information
smlx authored Aug 18, 2023
2 parents 2575c03 + 0da7f4f commit ace2997
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 0 additions & 7 deletions helper_test.go

This file was deleted.

9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ func walkCommits(r *git.Repository, tagRefs map[string]string, order git.LogOrde
return latestVersion, major, minor, patch, nil
}

// nextVersion returns a string containing the next version based on the state
// of the git repository in path.
func nextVersion(path string) (string, error) {
// NextVersion returns a string containing the next version based on the state
// of the git repository in path. It inspects the most recent tag, and the
// commits made after that tag.
func NextVersion(path string) (string, error) {
// open repository
r, err := git.PlainOpenWithOptions(path, &git.PlainOpenOptions{DetectDotGit: true})
if err != nil {
Expand Down Expand Up @@ -132,7 +133,7 @@ func main() {
if err != nil {
panic(err)
}
next, err := nextVersion(`.`)
next, err := NextVersion(`.`)
if err != nil {
log.Fatal("couldn't get next version", zap.Error(err))
}
Expand Down

0 comments on commit ace2997

Please sign in to comment.