tests/thirdparty: use shallow clone (#224)
When trying to add a test case from the standard library, cloning golang/go was taking forever. This PR switches to a shallow clone.
This commit is contained in:
committed by
GitHub
parent
f355d27b13
commit
1de006d741
19
tests/thirdparty/packages_test.go
vendored
19
tests/thirdparty/packages_test.go
vendored
@@ -71,17 +71,18 @@ func (t *PackageTest) Run() {
|
|||||||
|
|
||||||
// checkout the code at the specified version.
|
// checkout the code at the specified version.
|
||||||
func (t *PackageTest) checkout() {
|
func (t *PackageTest) checkout() {
|
||||||
// Clone repo.
|
// Determine the version we want to checkout.
|
||||||
dst := filepath.Join(t.WorkDir, t.Name())
|
version := t.Version
|
||||||
test.Exec(t.T, "git", "clone", "--quiet", t.Repository.CloneURL(), dst)
|
|
||||||
t.repopath = dst
|
|
||||||
|
|
||||||
// Checkout specific version.
|
|
||||||
if t.Latest {
|
if t.Latest {
|
||||||
t.Log("using latest version")
|
version = t.DefaultBranch
|
||||||
return
|
|
||||||
}
|
}
|
||||||
test.Exec(t.T, "git", "-C", t.repopath, "checkout", "--quiet", t.Version)
|
|
||||||
|
// Clone. Use a shallow clone to speed up large repositories.
|
||||||
|
t.repopath = filepath.Join(t.WorkDir, t.Name())
|
||||||
|
test.Exec(t.T, "git", "init", t.repopath)
|
||||||
|
test.Exec(t.T, "git", "-C", t.repopath, "remote", "add", "origin", t.Repository.CloneURL())
|
||||||
|
test.Exec(t.T, "git", "-C", t.repopath, "fetch", "--depth=1", "origin", version)
|
||||||
|
test.Exec(t.T, "git", "-C", t.repopath, "checkout", "FETCH_HEAD")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *PackageTest) steps() {
|
func (t *PackageTest) steps() {
|
||||||
|
|||||||
Reference in New Issue
Block a user