* moving cloning back to remote url (since this makes it compatible with more go versions)

This commit is contained in:
Yashodhan Ghadge 2021-10-21 20:25:53 +05:30
parent 563a351424
commit 4cd604a885
1 changed files with 7 additions and 15 deletions

View File

@ -4,6 +4,7 @@ import (
"github.com/sosedoff/gitkit" "github.com/sosedoff/gitkit"
"io/ioutil" "io/ioutil"
"net/http/httptest" "net/http/httptest"
"os"
"testing" "testing"
) )
@ -89,25 +90,16 @@ func StartHTTP(repoDir string) (*httptest.Server, error) {
return server, nil return server, nil
} }
// TestCloneWithExternalHTTPUrWithLocalServer // TestCloneWithExternalHTTPUrl
func TestCloneWithExternalHTTPUrWithLocalServer(t *testing.T) { func TestCloneWithExternalHTTPUrl(t *testing.T) {
// create an empty repo
repo := createTestRepo(t)
defer cleanupTestRepo(t, repo)
seedTestRepo(t, repo)
// initialize a git server at the path of the newly created repo
serv, err := StartHTTP(repo.Workdir())
checkFatal(t, err)
// clone the repo
url := serv.URL + "/.git"
path, err := ioutil.TempDir("", "git2go") path, err := ioutil.TempDir("", "git2go")
defer os.RemoveAll(path) defer os.RemoveAll(path)
// clone the repo
url := "https://github.com/libgit2/TestGitRepository"
_, err = Clone(url, path, &CloneOptions{}) _, err = Clone(url, path, &CloneOptions{})
if err != nil { if err != nil {
t.Fatal("cannot clone remote repo via http, error: ", err) t.Fatal("cannot clone remote repo via https, error: ", err)
} }
} }