()
| 137 | } |
| 138 | |
| 139 | func initLibGit2() { |
| 140 | pointerHandles = NewHandleList() |
| 141 | remotePointers = newRemotePointerList() |
| 142 | |
| 143 | C.git_libgit2_init() |
| 144 | features := Features() |
| 145 | |
| 146 | // Due to the multithreaded nature of Go and its interaction with |
| 147 | // calling C functions, we cannot work with a library that was not built |
| 148 | // with multi-threading support. The most likely outcome is a segfault |
| 149 | // or panic at an incomprehensible time, so let's make it easy by |
| 150 | // panicking right here. |
| 151 | if features&FeatureThreads == 0 { |
| 152 | panic("libgit2 was not built with threading support") |
| 153 | } |
| 154 | |
| 155 | if features&FeatureHTTPS == 0 { |
| 156 | if err := registerManagedHTTP(); err != nil { |
| 157 | panic(err) |
| 158 | } |
| 159 | } else { |
| 160 | // This is not something we should be doing, as we may be stomping all over |
| 161 | // someone else's setup. The user should do this themselves or use some |
| 162 | // binding/wrapper which does it in such a way that they can be sure |
| 163 | // they're the only ones setting it up. |
| 164 | C.git_openssl_set_locking() |
| 165 | } |
| 166 | if features&FeatureSSH == 0 { |
| 167 | if err := registerManagedSSH(); err != nil { |
| 168 | panic(err) |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | // Shutdown frees all the resources acquired by libgit2. Make sure no |
| 174 | // references to any git2go objects are live before calling this. |
no test coverage detected
searching dependent graphs…