diff options
author | ferhat elmas <elmas.ferhat@gmail.com> | 2016-11-15 01:18:53 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-11-15 01:18:53 +0100 |
commit | 16d86605732ba3198c0acd4317b53cf4991a7d4d (patch) | |
tree | 3306f0438235f7dfe19fd37c5393a4794abe0535 /plumbing/client/common.go | |
parent | eb89d2dd9a36440d58aea224c055b364e49785f7 (diff) | |
download | go-git-16d86605732ba3198c0acd4317b53cf4991a7d4d.tar.gz |
Add configurable http client factory (fixes #120) (#121)
* new http client factory ready to install/override default http(s)
* mv GitUploadPackServiceFactory to clients.common pkg
* rename http.HTTPError to http.Err
* rename http.HTTPAuthMethod to http.AuthMethod
* add doc and examples/ usage
* general improvements:
- update install link in readme to v4 (example are already pointing v4)
- fix indentation in package doc (styling for godoc.org)
- use http.Status constants instead of integers
- close leaked response body
- rm named returns which stutter in doc
- fix one format string
- rm unnecessary if checks
- documentation fixes
Diffstat (limited to 'plumbing/client/common.go')
-rw-r--r-- | plumbing/client/common.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/plumbing/client/common.go b/plumbing/client/common.go index 6a99339..1524753 100644 --- a/plumbing/client/common.go +++ b/plumbing/client/common.go @@ -1,4 +1,4 @@ -// Package clients includes the implementation for diferent transport protocols +// Package clients includes the implementation for different transport protocols // // go-git needs the packfile and the refs of the repo. The // `NewGitUploadPackService` function returns an object that allows to @@ -21,17 +21,15 @@ import ( "gopkg.in/src-d/go-git.v4/plumbing/client/ssh" ) -type GitUploadPackServiceFactory func(common.Endpoint) common.GitUploadPackService - // Protocols are the protocols supported by default. -var Protocols = map[string]GitUploadPackServiceFactory{ +var Protocols = map[string]common.GitUploadPackServiceFactory{ "http": http.NewGitUploadPackService, "https": http.NewGitUploadPackService, "ssh": ssh.NewGitUploadPackService, } // InstallProtocol adds or modifies an existing protocol. -func InstallProtocol(scheme string, f GitUploadPackServiceFactory) { +func InstallProtocol(scheme string, f common.GitUploadPackServiceFactory) { Protocols[scheme] = f } |