diff --git a/internal/client/git.go b/internal/client/git.go index 03790b67..a94463a8 100644 --- a/internal/client/git.go +++ b/internal/client/git.go @@ -1,7 +1,6 @@ package client import ( - "fmt" "io" "path" "regexp" @@ -208,41 +207,6 @@ func (g *GitClient) Logs(from string, to string) ([]*object.Commit, error) { return commits, errors.WithStack(err) } -// get commit hash from a string -// str: HEAD -// str: HASH -// str: tag -func (g *GitClient) getCommitHash(str string) (string, error) { - if str == "HEAD" { - commit, err := g.repository.Head() - - if err != nil { - return "", errors.WithStack(err) - } - - return commit.Hash().String(), nil - } else { - version := versionRegexp.ReplaceAllString(str, "") - _, err := semver.New(version) - - if err != nil { - return "", errors.WithStack(err) - } - - tag, err := g.TagName(str) - - if err != nil { - return "", errors.WithStack(err) - } - - if tag == nil { - return "", errors.New(fmt.Sprintf(`tag '%s' not exist`, str)) - } - - return tag.Commit.Hash.String(), nil - } -} - // Get tags with range // eg. Get all tags between v2.0.0 and v1.0.0 and including thenself // start: v2.0.0