From 788abb174fbfb428dfaeaf3424bd142a807c89e4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 22 Oct 2019 15:57:26 +0200 Subject: pkg/vcs: detect old git binary that can't do bisection --- pkg/vcs/test_util.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pkg/vcs') diff --git a/pkg/vcs/test_util.go b/pkg/vcs/test_util.go index 55bd7bccd..148360a08 100644 --- a/pkg/vcs/test_util.go +++ b/pkg/vcs/test_util.go @@ -3,6 +3,7 @@ package vcs import ( "fmt" "path/filepath" + "strings" "testing" "time" @@ -82,6 +83,14 @@ func (repo *TestRepo) SetTag(tag string) { repo.git("tag", tag) } +func (repo *TestRepo) SupportsBisection() bool { + // Detect too old git binary. --no-contains appeared in git 2.13. + _, err := repo.repo.previousReleaseTags("HEAD", true) + return err == nil || + !strings.Contains(err.Error(), "usage: git tag") && + !strings.Contains(err.Error(), "error: unknown option") +} + func CreateTestRepo(t *testing.T, baseDir, name string) *TestRepo { repo := MakeTestRepo(t, filepath.Join(baseDir, name)) repo.git("checkout", "-b", "master") -- cgit mrf-deployment