diff options
| author | nulltoken <emeric.fermas@gmail.com> | 2012-11-10 20:42:45 +0100 |
|---|---|---|
| committer | nulltoken <emeric.fermas@gmail.com> | 2012-11-10 20:42:45 +0100 |
| commit | 69c068c79f5b6d2fe5cf1ca707a130a51939abc2 (patch) | |
| tree | d2099e9ca1d22105d0af705b3d3943d98b2350ec | |
| parent | 353e991679824bd2ea146fefab6a25ce6d5577a2 (diff) | |
| download | libgit2-69c068c79f5b6d2fe5cf1ca707a130a51939abc2.tar.gz | |
index: make git_index_new() work with a NULL path
| -rw-r--r-- | src/index.c | 2 | ||||
| -rw-r--r-- | tests-clar/index/inmemory.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c index 214d29def..6c04177e5 100644 --- a/src/index.c +++ b/src/index.c @@ -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); diff --git a/tests-clar/index/inmemory.c b/tests-clar/index/inmemory.c new file mode 100644 index 000000000..9c5c0b7a4 --- /dev/null +++ b/tests-clar/index/inmemory.c @@ -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); +} |
