@@ -21,7 +21,6 @@ r, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{
2121
2222As soon as you have a `Repository` instance, you can access information and perform mutations on it:
2323
24-
2524[source, go]
2625-----
2726// retrieves the branch pointed by HEAD
@@ -39,7 +38,6 @@ for _, c := range history {
3938}
4039-----
4140
42-
4341==== Advanced Functionality
4442
4543go-git has few notable advanced features, one of which is a pluggable storage system, which is similar to Libgit2 backends.
@@ -63,13 +61,13 @@ Another advanced use-case includes a fine-tunable HTTP client, such as the one f
6361[source, go]
6462-----
6563customClient := &http.Client{
66- Transport: &http.Transport{ // accept any certificate (might be useful for testing)
67- TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
68- },
69- Timeout: 15 * time.Second, // 15 second timeout
70- CheckRedirect: func(req *http.Request, via []*http.Request) error {
71- return http.ErrUseLastResponse // don't follow redirect
72- },
64+ Transport: &http.Transport{ // accept any certificate (might be useful for testing)
65+ TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
66+ },
67+ Timeout: 15 * time.Second, // 15 second timeout
68+ CheckRedirect: func(req *http.Request, via []*http.Request) error {
69+ return http.ErrUseLastResponse // don't follow redirect
70+ },
7371}
7472
7573// Override http(s) default protocol to use our custom client
@@ -79,7 +77,6 @@ client.InstallProtocol("https", githttp.NewClient(customClient))
7977r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{URL: url})
8078-----
8179
82-
8380==== Further Reading
8481
8582A full treatment of go-git's capabilities is outside the scope of this book.
0 commit comments