From 104224c9f081fbe79757976a8c1f903ae94c3f8a Mon Sep 17 00:00:00 2001 From: amine Date: Fri, 1 Nov 2019 18:39:45 +0100 Subject: repository: add StoreTimestamp/StoreBool to the config interface repository: move the gitVersion logic to *gitConfig struct --- repository/git.go | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'repository/git.go') diff --git a/repository/git.go b/repository/git.go index c25309f5..0951b577 100644 --- a/repository/git.go +++ b/repository/git.go @@ -7,10 +7,8 @@ import ( "io" "os/exec" "path" - "regexp" "strings" - "github.com/blang/semver" "github.com/pkg/errors" "github.com/MichaelMure/git-bug/util/git" @@ -206,44 +204,6 @@ func (repo *GitRepo) GetRemotes() (map[string]string, error) { return remotes, nil } -func (repo *GitRepo) GitVersion() (*semver.Version, error) { - versionOut, err := repo.runGitCommand("version") - if err != nil { - return nil, err - } - - // extract the version and truncate potential bad parts - // ex: 2.23.0.rc1 instead of 2.23.0-rc1 - r := regexp.MustCompile(`(\d+\.){1,2}\d+`) - - extracted := r.FindString(versionOut) - if extracted == "" { - return nil, fmt.Errorf("unreadable git version %s", versionOut) - } - - version, err := semver.Make(extracted) - if err != nil { - return nil, err - } - - return &version, nil -} - -func (repo *GitRepo) gitVersionLT218() (bool, error) { - version, err := repo.GitVersion() - if err != nil { - return false, err - } - - version218string := "2.18.0" - gitVersion218, err := semver.Make(version218string) - if err != nil { - return false, err - } - - return version.LT(gitVersion218), nil -} - // FetchRefs fetch git refs from a remote func (repo *GitRepo) FetchRefs(remote, refSpec string) (string, error) { stdout, err := repo.runGitCommand("fetch", remote, refSpec) -- cgit