Connect opens a connection to a remote. The transport is selected based on the URL. The direction argument is due to a limitation of the git protocol (over TCP or SSH) which starts up a specific binary which can only do the one or the other. 'headers' are extra HTTP headers to use in this connecti
(direction ConnectDirection, callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string)
| 1081 | // |
| 1082 | // 'headers' are extra HTTP headers to use in this connection. |
| 1083 | func (o *Remote) Connect(direction ConnectDirection, callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error { |
| 1084 | var err error |
| 1085 | ccallbacks := populateRemoteCallbacks(&C.git_remote_callbacks{}, callbacks, &err) |
| 1086 | defer untrackCallbacksPayload(ccallbacks) |
| 1087 | |
| 1088 | cproxy := populateProxyOptions(&C.git_proxy_options{}, proxyOpts) |
| 1089 | defer freeProxyOptions(cproxy) |
| 1090 | |
| 1091 | cheaders := C.git_strarray{ |
| 1092 | count: C.size_t(len(headers)), |
| 1093 | strings: makeCStringsFromStrings(headers), |
| 1094 | } |
| 1095 | defer freeStrarray(&cheaders) |
| 1096 | |
| 1097 | runtime.LockOSThread() |
| 1098 | defer runtime.UnlockOSThread() |
| 1099 | |
| 1100 | ret := C.git_remote_connect(o.ptr, C.git_direction(direction), ccallbacks, cproxy, &cheaders) |
| 1101 | runtime.KeepAlive(o) |
| 1102 | if ret == C.int(ErrorCodeUser) && err != nil { |
| 1103 | return err |
| 1104 | } |
| 1105 | if ret != 0 { |
| 1106 | return MakeGitError(ret) |
| 1107 | } |
| 1108 | return nil |
| 1109 | } |
| 1110 | |
| 1111 | func (o *Remote) Disconnect() { |
| 1112 | runtime.LockOSThread() |
no test coverage detected