libgit2/pygit2 — pull request #202 by cboos (2013-04-05 12:57:25+00:00)
Title: pygit2 should work with libgit2 built with THREADSAFE=ON

I just built libgit2 with `-DTHREADSAFE=ON` (it's *not* the default), and when trying to test the corresponding build of pygit2, I got:

```
$ python setup.py test
running test
running build
running build_py
copying pygit2/__init__.py -> build/lib.linux-x86_64-2.7/pygit2
copying pygit2/repository.py -> build/lib.linux-x86_64-2.7/pygit2
copying pygit2/utils.py -> build/lib.linux-x86_64-2.7/pygit2
copying pygit2/version.py -> build/lib.linux-x86_64-2.7/pygit2
running build_ext
python: /packages/libgit2/libgit2/src/global.c:151: git__global_state: Assertion `_tls_init' failed.
Aborted
```

It seems that [git_threads_init](http://libgit2.github.com/libgit2/#HEAD/group/threads/git_threads_init) was never called.

After adding it (this patch), I get:

```
python setup.py test
running test
running build
running build_py
copying pygit2/__init__.py -> build/lib.linux-x86_64-2.7/pygit2
copying pygit2/repository.py -> build/lib.linux-x86_64-2.7/pygit2
copying pygit2/utils.py -> build/lib.linux-x86_64-2.7/pygit2
copying pygit2/version.py -> build/lib.linux-x86_64-2.7/pygit2
running build_ext
...........................................................................................................................
----------------------------------------------------------------------
Ran 123 tests in 5.188s

OK
```

Much better ;-)