diff options
author | amine <hilalyamine@gmail.com> | 2019-11-01 18:39:45 +0100 |
---|---|---|
committer | amine <hilalyamine@gmail.com> | 2019-11-01 18:39:45 +0100 |
commit | 104224c9f081fbe79757976a8c1f903ae94c3f8a (patch) | |
tree | ab3f954fe9ba86099c1606cf0fb074834d318834 /repository/git.go | |
parent | 7f177c4750b4acf70cc3fd3d43c19685179e527b (diff) | |
download | git-bug-104224c9f081fbe79757976a8c1f903ae94c3f8a.tar.gz |
repository: add StoreTimestamp/StoreBool to the config interface
repository: move the gitVersion logic to *gitConfig struct
Diffstat (limited to 'repository/git.go')
-rw-r--r-- | repository/git.go | 40 |
1 files changed, 0 insertions, 40 deletions
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) |