index: make git_index_new() work with a NULL path

This commit is contained in:
nulltoken 2012-11-10 20:42:45 +01:00
parent 353e991679
commit 69c068c79f
2 changed files with 12 additions and 1 deletions

View File

@ -259,7 +259,7 @@ int git_index_open(git_index **index_out, const char *index_path)
{
git_index *index;
assert(index_out && index_path);
assert(index_out);
index = git__calloc(1, sizeof(git_index));
GITERR_CHECK_ALLOC(index);

View File

@ -0,0 +1,11 @@
#include "clar_libgit2.h"
void test_index_inmemory__can_create_an_inmemory_index(void)
{
git_index *index;
cl_git_pass(git_index_new(&index));
cl_assert_equal_i(0, git_index_entrycount(index));
git_index_free(index);
}