aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-12-12 15:50:03 +0100
committerGitHub <noreply@github.com>2016-12-12 15:50:03 +0100
commit3967812bd0de40330dfbb9e1a7d14d4073cc1b10 (patch)
treedbd5df2a66bdd50df40fd773e1d1ec284483ecfe /remote_test.go
parent6f701ecc18909959364b708b8efddd03cf4e809c (diff)
downloadgo-git-3967812bd0de40330dfbb9e1a7d14d4073cc1b10.tar.gz
examples: review, testing and documentation (#176)
* examples reviews, testing and documentation * including the execution on travis, and fix readme * fix example link * including the execution on travis
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/remote_test.go b/remote_test.go
index c3e86df..a4e8e35 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -2,20 +2,14 @@ package git
import (
"bytes"
- "crypto/tls"
- "fmt"
"io"
"io/ioutil"
- "net/http"
"os"
- "time"
"gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
- "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/filesystem"
"gopkg.in/src-d/go-git.v4/storage/memory"
osfs "gopkg.in/src-d/go-git.v4/utils/fs/os"
@@ -259,43 +253,3 @@ func (s *RemoteSuite) TestString(c *C) {
"foo\thttps://github.com/git-fixtures/basic.git (push)",
)
}
-
-// Here is an example to configure http client according to our own needs.
-func Example_customHTTPClient() {
- const url = "https://github.com/git-fixtures/basic.git"
-
- // Create a custom http(s) client with your config
- customClient := &http.Client{
- Transport: &http.Transport{
- TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
- }, // accept any certificate (might be useful for testing)
- Timeout: 15 * time.Second, // 15 second timeout
- CheckRedirect: func(req *http.Request, via []*http.Request) error { // don't follow redirect
- return http.ErrUseLastResponse
- },
- }
-
- // Override http(s) default protocol to use our custom client
- client.InstallProtocol(
- "https",
- githttp.NewClient(customClient))
-
- // Create an in-memory repository
- r := NewMemoryRepository()
-
- // Clone repo
- if err := r.Clone(&CloneOptions{URL: url}); err != nil {
- panic(err)
- }
-
- // Retrieve the branch pointed by HEAD
- head, err := r.Head()
- if err != nil {
- panic(err)
- }
-
- // Print latest commit hash
- fmt.Println(head.Hash())
- // Output:
- // 6ecf0ef2c2dffb796033e5a02219af86ec6584e5
-}