diff --git a/cmd/publish.go b/cmd/publish.go index 5ccdf24..60136e1 100644 --- a/cmd/publish.go +++ b/cmd/publish.go @@ -5,11 +5,12 @@ import ( "fmt" "strings" - "github.com/commitsar-app/git/pkg" + history "github.com/commitsar-app/git/pkg" "github.com/commitsar-app/release-notary/internal/releaser" "github.com/commitsar-app/release-notary/internal/text" "github.com/spf13/cobra" "github.com/spf13/viper" + "gopkg.in/src-d/go-git.v4/plumbing" ) func init() { @@ -44,6 +45,11 @@ var publishCmd = &cobra.Command{ return err } + // If previous tag is not available, provide empty hash so that all commits are iterated. + if err == history.ErrPrevTagNotAvailable { + lastTag = plumbing.Hash{} + } + commits, err := repo.CommitsBetween(currentCommit.Hash, lastTag) if err != nil { diff --git a/go.mod b/go.mod index 41e79b7..09f2776 100644 --- a/go.mod +++ b/go.mod @@ -8,4 +8,5 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 + gopkg.in/src-d/go-git.v4 v4.13.1 )