diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-29 02:27:16 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-29 22:36:15 +0100 |
commit | acb1dc80d93f45a055b14903679abca3a6e994f6 (patch) | |
tree | a7e29fd677bb5c11df85fca1fcb6d015bc40fa7b /examples/custom_http/main.go | |
parent | 352170d1bf8cc7b32b85d8a2740eb3627e952a6e (diff) | |
download | go-git-acb1dc80d93f45a055b14903679abca3a6e994f6.tar.gz |
example: using new constructors
Diffstat (limited to 'examples/custom_http/main.go')
-rw-r--r-- | examples/custom_http/main.go | 6 |
1 files changed, 2 insertions, 4 deletions
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 |