libgit2/libgit2 — pull request #629 by nulltoken (2012-04-14 12:22:35+00:00)
Title: Index refcount issue

`git_repository_free()` calls `git_index_free()` if the owned index is not null.

According to the [doc](https://github.com/libgit2/libgit2/blob/development/include/git2/repository.h#L273-286), when setting a new index through `git_repository_set_index()` the caller has still to take care of releasing the index by itself.

In order to cope with this, this fix makes sure the index refcount is incremented when a new repository is being plugged a new index.