Add Feature query support & panic if libgit2 is not thread-aware #354
9
git.go
9
git.go
|
@ -124,6 +124,15 @@ func init() {
|
|||
|
||||
C.git_libgit2_init()
|
||||
|
||||
// Due to the multithreaded nature of Go and its interaction with
|
||||
// calling C functions, we cannot work with a library that was not built
|
||||
// with multi-threading support. The most likely outcome is a segfault
|
||||
// or panic at an incomprehensible time, so let's make it easy by
|
||||
// panicking right here.
|
||||
if Features()&FeatureThreads == 0 {
|
||||
panic("libgit2 was not built with threading support")
|
||||
}
|
||||
|
||||
// This is not something we should be doing, as we may be
|
||||
// stomping all over someone else's setup. The user should do
|
||||
// this themselves or use some binding/wrapper which does it
|
||||
|
|
Loading…
Reference in New Issue