bugfix: HTTPS Clone fails with remote pointer not found using Go transport (#836) #842

Merged
codexetreme merged 10 commits from bugfix/error_while_cloning into main 2021-10-23 12:33:11 -05:00
1 changed files with 7 additions and 15 deletions
Showing only changes of commit 4cd604a885 - Show all commits

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
} }
lhchavez commented 2021-10-21 08:55:17 -05:00 (Migrated from github.com)
Review
	_, err = Clone("https://github.com/libgit2/TestGitRepository", path, &CloneOptions{})

:'( let's give up in the hermeticity in favor of supporting more Go versions.

```suggestion _, err = Clone("https://github.com/libgit2/TestGitRepository", path, &CloneOptions{}) ``` :'( let's give up in the hermeticity in favor of supporting more Go versions.
codexetreme commented 2021-10-21 09:34:38 -05:00 (Migrated from github.com)
Review

Cool, let me remove that dependency and related code

Cool, let me remove that dependency and related code
codexetreme commented 2021-10-21 09:56:24 -05:00 (Migrated from github.com)
Review

okay I've made the changes

okay I've made the changes
// TestCloneWithExternalHTTPUrWithLocalServer // TestCloneWithExternalHTTPUrl
func TestCloneWithExternalHTTPUrWithLocalServer(t *testing.T) { func TestCloneWithExternalHTTPUrl(t *testing.T) {
lhchavez commented 2021-10-21 07:28:27 -05:00 (Migrated from github.com)
Review
		t.Fatal("cannot clone remote repo via http, error: ", err)
```suggestion t.Fatal("cannot clone remote repo via http, error: ", err) ```
// 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)
} }
} }