mirror of
https://github.com/reactos/syzkaller.git
synced 2024-12-18 00:58:10 +00:00
pkg/vcs: detect old git binary that can't do bisection
This commit is contained in:
parent
084e388155
commit
788abb174f
@ -85,6 +85,9 @@ func TestBisectCause(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if !originRepo.SupportsBisection() {
|
||||
t.Skip("bisection is unsupported by git (probably too old version)")
|
||||
}
|
||||
repo := vcs.CloneTestRepo(t, baseDir, "repo", originRepo)
|
||||
r, err := vcs.NewRepo("test", "64", repo.Dir)
|
||||
if err != nil {
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user