FetchOptions: add ability to specify ProxyOptions (#623)

Prior to this change you could not specifiy proxy options on the
FetchOptions struct, which made it impossible to specify a proxy for an
initial clone. This change adds the ProxyOptions to the FetchOptions
struct so you can go through a proxy when cloning.

(cherry picked from commit b1cad11555)
This commit is contained in:
Jesse Hathaway 2020-07-10 15:00:52 -05:00 committed by lhchavez
parent d5fa51db4f
commit 6c1af418ae
1 changed files with 4 additions and 0 deletions

View File

@ -116,6 +116,9 @@ type FetchOptions struct {
// Headers are extra headers for the fetch operation. // Headers are extra headers for the fetch operation.
Headers []string Headers []string
// Proxy options to use for this fetch operation
ProxyOptions ProxyOptions
} }
type ProxyType uint type ProxyType uint
@ -687,6 +690,7 @@ func populateFetchOptions(options *C.git_fetch_options, opts *FetchOptions) {
options.custom_headers = C.git_strarray{} options.custom_headers = C.git_strarray{}
options.custom_headers.count = C.size_t(len(opts.Headers)) options.custom_headers.count = C.size_t(len(opts.Headers))
options.custom_headers.strings = makeCStringsFromStrings(opts.Headers) options.custom_headers.strings = makeCStringsFromStrings(opts.Headers)
populateProxyOptions(&options.proxy_opts, &opts.ProxyOptions)
} }
func populatePushOptions(options *C.git_push_options, opts *PushOptions) { func populatePushOptions(options *C.git_push_options, opts *PushOptions) {