From c86c8358322d3e3fcd11dc33941e10d7d51f424e Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Fri, 15 Oct 2021 14:10:24 +0530 Subject: [PATCH 01/10] * adding a weak bool param for Remote * create a new remote in the smartTransportCallback incase one is not found --- remote.go | 15 +++++++++++++++ transport.go | 2 ++ 2 files changed, 17 insertions(+) diff --git a/remote.go b/remote.go index 7abc461a..f4424fc2 100644 --- a/remote.go +++ b/remote.go @@ -182,6 +182,9 @@ type Remote struct { ptr *C.git_remote callbacks RemoteCallbacks repo *Repository + // weak indicates that a remote is a weak pointer and should not be + // freed. + weak bool } type remotePointerList struct { @@ -602,6 +605,9 @@ func (r *Remote) free() { // Free releases the resources of the Remote. func (r *Remote) Free() { r.repo.Remotes.untrackRemote(r) + if r.weak { + return + } r.free() } @@ -1231,3 +1237,12 @@ func freeRemoteCreateOptions(ptr *C.git_remote_create_options) { C.free(unsafe.Pointer(ptr.name)) C.free(unsafe.Pointer(ptr.fetchspec)) } + +// createNewEmptyRemote used to get a new empty object of *Remote +func createNewEmptyRemote() *Remote { + return &Remote{ + callbacks: RemoteCallbacks{}, + repo: nil, + weak: false, + } +} diff --git a/transport.go b/transport.go index 1afa6f4c..525c7049 100644 --- a/transport.go +++ b/transport.go @@ -307,6 +307,8 @@ func smartTransportCallback( remote, ok := remotePointers.get(owner) if !ok { err := errors.New("remote pointer not found") + remote = createNewEmptyRemote() + remote.weak = true return setCallbackError(errorMessage, err) } From 4df4cbd5e33b202e74367e861ea81560ffdeb677 Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Fri, 15 Oct 2021 14:34:35 +0530 Subject: [PATCH 02/10] * removing error code and creating a new empty remote instead if the owner remote is not found in the list of tracked remotes * adding a test to check if external clone via HTTPS works --- clone_test.go | 21 +++++++++++++++++++++ transport.go | 5 ++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/clone_test.go b/clone_test.go index 8814dd00..c6ea5041 100644 --- a/clone_test.go +++ b/clone_test.go @@ -1,8 +1,11 @@ package git import ( + "fmt" "io/ioutil" + "net" "testing" + "time" ) const ( @@ -70,3 +73,21 @@ func TestCloneWithCallback(t *testing.T) { } defer remote.Free() } + +// TestCloneWithExternalHTTPSUrl warning: this test might be flaky +func TestCloneWithExternalHTTPSUrl(t *testing.T) { + // fail the test, if the URL is not reachable + timeout := 1 * time.Second + _, err := net.DialTimeout("tcp", "github.com:443", timeout) + if err != nil { + t.Fatal("Site unreachable, retry later, error: ", err) + } + + url := "https://github.com/libgit2/git2go.git" + fmt.Println(url) + path, err := ioutil.TempDir("", "git2go") + _, err = Clone(url, path, &CloneOptions{}) + if err != nil { + t.Fatal("cannot clone remote repo via https, error: ", err) + } +} diff --git a/transport.go b/transport.go index 525c7049..23514b47 100644 --- a/transport.go +++ b/transport.go @@ -22,7 +22,6 @@ void _go_git_setup_smart_subtransport_stream(_go_managed_smart_subtransport_stre */ import "C" import ( - "errors" "fmt" "io" "reflect" @@ -306,10 +305,10 @@ func smartTransportCallback( registeredSmartTransport := pointerHandles.Get(handle).(*RegisteredSmartTransport) remote, ok := remotePointers.get(owner) if !ok { - err := errors.New("remote pointer not found") + // create a new empty remote and set it + // as a weak pointer, so that control stays in golang remote = createNewEmptyRemote() remote.weak = true - return setCallbackError(errorMessage, err) } managed := &managedSmartSubtransport{ From 8e8cb91f501d8309e0e07f20a19271ff5a72fdc4 Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Thu, 21 Oct 2021 00:08:57 +0530 Subject: [PATCH 03/10] * moving cloning tests to use gitkit git server (removes the need for network and external hosted repos) * updating go.mod (and go.sum) with the new required dependency on gitkit --- clone_test.go | 43 +++++++++++++++++++++++++++++++------------ go.mod | 3 ++- go.sum | 17 +++++++++++++++++ 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/clone_test.go b/clone_test.go index c6ea5041..b7f4fe2c 100644 --- a/clone_test.go +++ b/clone_test.go @@ -1,11 +1,10 @@ package git import ( - "fmt" + "github.com/sosedoff/gitkit" "io/ioutil" - "net" + "net/http/httptest" "testing" - "time" ) const ( @@ -74,17 +73,37 @@ func TestCloneWithCallback(t *testing.T) { defer remote.Free() } -// TestCloneWithExternalHTTPSUrl warning: this test might be flaky -func TestCloneWithExternalHTTPSUrl(t *testing.T) { - // fail the test, if the URL is not reachable - timeout := 1 * time.Second - _, err := net.DialTimeout("tcp", "github.com:443", timeout) - if err != nil { - t.Fatal("Site unreachable, retry later, error: ", err) +// StartHTTP starts a new HTTP git server with the current configuration. +func StartHTTP(repoDir string) (*httptest.Server, error) { + service := gitkit.New(gitkit.Config{ + Dir: repoDir, + Auth: false, + Hooks: &gitkit.HookScripts{}, + AutoCreate: false, + }) + + if err := service.Setup(); err != nil { + return nil, err } + server := httptest.NewServer(service) + return server, nil +} + +// TestCloneWithExternalHTTPUrWithLocalServer +func TestCloneWithExternalHTTPUrWithLocalServer(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) - url := "https://github.com/libgit2/git2go.git" - fmt.Println(url) + // clone the repo + url := serv.URL + "/.git" path, err := ioutil.TempDir("", "git2go") _, err = Clone(url, path, &CloneOptions{}) if err != nil { diff --git a/go.mod b/go.mod index c8028ef3..046de4e2 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.13 require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 - golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c + github.com/sosedoff/gitkit v0.3.0 + golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect ) diff --git a/go.sum b/go.sum index 35ff116b..7f4ad6ec 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,30 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sosedoff/gitkit v0.3.0 h1:TfINVRNUM+GcFa+LGhZ3RcWN86Im1M6i8qs0IsgMy90= +github.com/sosedoff/gitkit v0.3.0/go.mod h1:V3EpGZ0nvCBhXerPsbDeqtyReNb48cwP9KtkUYTKT5I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c h1:9HhBz5L/UjnK9XLtiZhYAdue5BVKep3PMmS2LuPDt8k= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 406940513fe5aa1407d1f745b49530686e94c35f Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Thu, 21 Oct 2021 18:49:44 +0530 Subject: [PATCH 04/10] Update clone_test.go Co-authored-by: lhchavez --- clone_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clone_test.go b/clone_test.go index b7f4fe2c..ea8a04f6 100644 --- a/clone_test.go +++ b/clone_test.go @@ -107,6 +107,6 @@ func TestCloneWithExternalHTTPUrWithLocalServer(t *testing.T) { path, err := ioutil.TempDir("", "git2go") _, err = Clone(url, path, &CloneOptions{}) if err != nil { - t.Fatal("cannot clone remote repo via https, error: ", err) + t.Fatal("cannot clone remote repo via http, error: ", err) } } From 563a35142454211b0413fa23865d69b01976f250 Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Thu, 21 Oct 2021 18:49:52 +0530 Subject: [PATCH 05/10] Update clone_test.go Co-authored-by: lhchavez --- clone_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/clone_test.go b/clone_test.go index ea8a04f6..96447814 100644 --- a/clone_test.go +++ b/clone_test.go @@ -105,6 +105,7 @@ func TestCloneWithExternalHTTPUrWithLocalServer(t *testing.T) { // clone the repo url := serv.URL + "/.git" path, err := ioutil.TempDir("", "git2go") + defer os.RemoveAll(path) _, err = Clone(url, path, &CloneOptions{}) if err != nil { t.Fatal("cannot clone remote repo via http, error: ", err) From 4cd604a885853a7c685553d70d790c7afb38ec86 Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Thu, 21 Oct 2021 20:25:53 +0530 Subject: [PATCH 06/10] * moving cloning back to remote url (since this makes it compatible with more go versions) --- clone_test.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/clone_test.go b/clone_test.go index 96447814..cd6442d6 100644 --- a/clone_test.go +++ b/clone_test.go @@ -4,6 +4,7 @@ import ( "github.com/sosedoff/gitkit" "io/ioutil" "net/http/httptest" + "os" "testing" ) @@ -89,25 +90,16 @@ func StartHTTP(repoDir string) (*httptest.Server, error) { return server, nil } -// TestCloneWithExternalHTTPUrWithLocalServer -func TestCloneWithExternalHTTPUrWithLocalServer(t *testing.T) { +// TestCloneWithExternalHTTPUrl +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") defer os.RemoveAll(path) + + // clone the repo + url := "https://github.com/libgit2/TestGitRepository" _, err = Clone(url, path, &CloneOptions{}) if err != nil { - t.Fatal("cannot clone remote repo via http, error: ", err) + t.Fatal("cannot clone remote repo via https, error: ", err) } } From 3193b2f6ccf6bbbc913cce01e748057ddedc42de Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Thu, 21 Oct 2021 21:24:21 +0530 Subject: [PATCH 07/10] * removing gitkit deps --- go.mod | 1 - go.sum | 15 ++++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 046de4e2..02fa5d94 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.13 require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 - github.com/sosedoff/gitkit v0.3.0 golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect ) diff --git a/go.sum b/go.sum index 7f4ad6ec..1711d410 100644 --- a/go.sum +++ b/go.sum @@ -1,30 +1,27 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sosedoff/gitkit v0.3.0 h1:TfINVRNUM+GcFa+LGhZ3RcWN86Im1M6i8qs0IsgMy90= github.com/sosedoff/gitkit v0.3.0/go.mod h1:V3EpGZ0nvCBhXerPsbDeqtyReNb48cwP9KtkUYTKT5I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c h1:9HhBz5L/UjnK9XLtiZhYAdue5BVKep3PMmS2LuPDt8k= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From cac86b09642f8ea03aaf730356e3137d1b58bfa7 Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Sat, 23 Oct 2021 01:04:21 +0530 Subject: [PATCH 08/10] * reverting go.mod and go.sum * removing gitkit imports --- clone_test.go | 1 - go.mod | 2 +- go.sum | 15 --------------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/clone_test.go b/clone_test.go index cd6442d6..7db75bc2 100644 --- a/clone_test.go +++ b/clone_test.go @@ -1,7 +1,6 @@ package git import ( - "github.com/sosedoff/gitkit" "io/ioutil" "net/http/httptest" "os" diff --git a/go.mod b/go.mod index 02fa5d94..c8028ef3 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.13 require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 - golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a + golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect ) diff --git a/go.sum b/go.sum index 1711d410..f209d055 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,5 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sosedoff/gitkit v0.3.0 h1:TfINVRNUM+GcFa+LGhZ3RcWN86Im1M6i8qs0IsgMy90= -github.com/sosedoff/gitkit v0.3.0/go.mod h1:V3EpGZ0nvCBhXerPsbDeqtyReNb48cwP9KtkUYTKT5I= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -21,7 +10,3 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From f200a9a4a7a70e02b28a9fdf7f2bc0205239c7d9 Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Sat, 23 Oct 2021 01:08:12 +0530 Subject: [PATCH 09/10] * reverting go.sum --- go.sum | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/go.sum b/go.sum index f209d055..35ff116b 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,13 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c h1:9HhBz5L/UjnK9XLtiZhYAdue5BVKep3PMmS2LuPDt8k= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From 8c556332a3388593df1ee871d7627b3451d15ec6 Mon Sep 17 00:00:00 2001 From: Yashodhan Ghadge Date: Sat, 23 Oct 2021 01:36:33 +0530 Subject: [PATCH 10/10] * remove unused fn --- clone_test.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/clone_test.go b/clone_test.go index 7db75bc2..9ff03e67 100644 --- a/clone_test.go +++ b/clone_test.go @@ -2,7 +2,6 @@ package git import ( "io/ioutil" - "net/http/httptest" "os" "testing" ) @@ -73,22 +72,6 @@ func TestCloneWithCallback(t *testing.T) { defer remote.Free() } -// StartHTTP starts a new HTTP git server with the current configuration. -func StartHTTP(repoDir string) (*httptest.Server, error) { - service := gitkit.New(gitkit.Config{ - Dir: repoDir, - Auth: false, - Hooks: &gitkit.HookScripts{}, - AutoCreate: false, - }) - - if err := service.Setup(); err != nil { - return nil, err - } - server := httptest.NewServer(service) - return server, nil -} - // TestCloneWithExternalHTTPUrl func TestCloneWithExternalHTTPUrl(t *testing.T) {