diff --git a/README.md b/README.md index 76147fec..75b3a5a5 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,12 @@ A cli to generate changelog > The project is in development feature: + - [x] Cross-platform support - [x] Template Support - [ ] Custom template - [x] Conventional Commits Parser +- [ ] Generate multiple versions of change logs ### Usage diff --git a/internal/client/git.go b/internal/client/git.go index 6513a35c..b96d6fd1 100644 --- a/internal/client/git.go +++ b/internal/client/git.go @@ -30,6 +30,7 @@ func NewGitClient(dir string) (*GitClient, error) { type GitClient struct { repository *git.Repository + tags []*Tag } func (g *GitClient) TagN(offset int) (*Tag, error) { @@ -92,6 +93,9 @@ func (g *GitClient) TagName(name string) (*Tag, error) { } func (g *GitClient) Tags() ([]*Tag, error) { + if g.tags != nil { + return g.tags, nil + } tags := make([]*Tag, 0) tt, _ := g.repository.References() @@ -142,6 +146,8 @@ func (g *GitClient) Tags() ([]*Tag, error) { return prevVersion.GT(*nextVersion) }) + g.tags = tags + return tags, nil }