aboutsummaryrefslogtreecommitdiffstats
path: root/examples/custom_http
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-01-29 02:27:16 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-29 22:36:15 +0100
commitacb1dc80d93f45a055b14903679abca3a6e994f6 (patch)
treea7e29fd677bb5c11df85fca1fcb6d015bc40fa7b /examples/custom_http
parent352170d1bf8cc7b32b85d8a2740eb3627e952a6e (diff)
downloadgo-git-acb1dc80d93f45a055b14903679abca3a6e994f6.tar.gz
example: using new constructors
Diffstat (limited to 'examples/custom_http')
-rw-r--r--examples/custom_http/main.go6
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