From acb1dc80d93f45a055b14903679abca3a6e994f6 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sun, 29 Jan 2017 02:27:16 +0100 Subject: example: using new constructors --- examples/custom_http/main.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'examples/custom_http/main.go') diff --git a/examples/custom_http/main.go b/examples/custom_http/main.go index 0853569..19f2ca3 100644 --- a/examples/custom_http/main.go +++ b/examples/custom_http/main.go @@ -11,6 +11,7 @@ import ( . "gopkg.in/src-d/go-git.v4/examples" "gopkg.in/src-d/go-git.v4/plumbing/transport/client" githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http" + "gopkg.in/src-d/go-git.v4/storage/memory" ) // Here is an example to configure http client according to our own needs. @@ -37,13 +38,10 @@ func main() { // Override http(s) default protocol to use our custom client client.InstallProtocol("https", githttp.NewClient(customClient)) - // Create an in-memory repository - r := git.NewMemoryRepository() - // Clone repository using the new client if the protocol is https:// Info("git clone %s", url) - err := r.Clone(&git.CloneOptions{URL: url}) + r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{URL: url}) CheckIfError(err) // Retrieve the branch pointed by HEAD -- cgit