File tree 1 file changed +20
-2
lines changed
1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -91,12 +91,30 @@ def push_url(self):
91
91
92
92
return maybe_string (C .git_remote_pushurl (self ._remote ))
93
93
94
- def connect (self , callbacks = None , direction = C .GIT_DIRECTION_FETCH ):
94
+ def connect (self , callbacks = None , direction = C .GIT_DIRECTION_FETCH , proxy = None ):
95
95
"""Connect to the remote.
96
+
97
+ Parameters:
98
+
99
+ proxy : None or True or str
100
+ Proxy configuration. Can be one of:
101
+
102
+ * `None` (the default) to disable proxy usage
103
+ * `True` to enable automatic proxy detection
104
+ * an url to a proxy (`http://proxy.example.org:3128/`)
96
105
"""
106
+ if proxy is not None :
107
+ proxy_opts = ffi .new ('git_proxy_options *' )
108
+ if proxy is True :
109
+ proxy_opts .type = C .GIT_PROXY_AUTO
110
+ elif proxy is not None :
111
+ proxy_opts .type = C .GIT_PROXY_SPECIFIED
112
+ proxy_opts .url = proxy
113
+ else :
114
+ proxy_opts = ffi .NULL
97
115
with git_remote_callbacks (callbacks ) as payload :
98
116
err = C .git_remote_connect (self ._remote , direction ,
99
- payload .remote_callbacks , ffi . NULL ,
117
+ payload .remote_callbacks , proxy_opts ,
100
118
ffi .NULL )
101
119
payload .check_error (err )
102
120
You can’t perform that action at this time.
0 commit comments