From c679bf42f53cd792c03c3d3b30d5e04901be6ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 18 Dec 2014 02:07:36 +0100 Subject: [PATCH 1/3] Create miscapitialised dirs for case-sensitive filesystems We need these directories to exist so cl_git_mkfile() can create the files we ask it to. --- tests/index/tests.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/index/tests.c b/tests/index/tests.c index a6c4b895c..6a751e71f 100644 --- a/tests/index/tests.c +++ b/tests/index/tests.c @@ -338,6 +338,10 @@ void test_index_tests__add_invalid_filename(void) cl_git_pass(git_repository_init(&repo, "./invalid", 0)); cl_must_pass(p_mkdir("./invalid/subdir", 0777)); + /* cl_git_mkfile() needs the dir to exist */ + cl_must_pass(p_mkdir("./invalid/.GIT", 0777)); + cl_must_pass(p_mkdir("./invalid/.GiT", 0777)); + add_invalid_filename(repo, ".git/hello"); add_invalid_filename(repo, ".GIT/hello"); add_invalid_filename(repo, ".GiT/hello"); From c90ed5b5583ab62f31cca55f4d9ea4386600e2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 18 Dec 2014 02:11:06 +0100 Subject: [PATCH 2/3] Plug leaks --- tests/index/tests.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/index/tests.c b/tests/index/tests.c index 6a751e71f..d0372f169 100644 --- a/tests/index/tests.c +++ b/tests/index/tests.c @@ -325,6 +325,7 @@ static void add_invalid_filename(git_repository *repo, const char *fn) cl_assert(git_index_entrycount(index) == 0); + git_buf_free(&path); git_index_free(index); } @@ -399,6 +400,7 @@ static void write_invalid_filename(git_repository *repo, const char *fn_orig) p_unlink(path.ptr); cl_git_pass(git_index_remove_all(index, NULL, NULL, NULL)); + git_buf_free(&path); git_index_free(index); git__free(fn); } From 284283180003a085ce03fb8fac2550a7ac9b9eb0 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 18 Dec 2014 12:41:59 -0600 Subject: [PATCH 3/3] index tests: test capitalization before mkdir --- tests/index/tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/index/tests.c b/tests/index/tests.c index d0372f169..a63183e10 100644 --- a/tests/index/tests.c +++ b/tests/index/tests.c @@ -340,8 +340,10 @@ void test_index_tests__add_invalid_filename(void) cl_must_pass(p_mkdir("./invalid/subdir", 0777)); /* cl_git_mkfile() needs the dir to exist */ - cl_must_pass(p_mkdir("./invalid/.GIT", 0777)); - cl_must_pass(p_mkdir("./invalid/.GiT", 0777)); + if (!git_path_exists("./invalid/.GIT")) + cl_must_pass(p_mkdir("./invalid/.GIT", 0777)); + if (!git_path_exists("./invalid/.GiT")) + cl_must_pass(p_mkdir("./invalid/.GiT", 0777)); add_invalid_filename(repo, ".git/hello"); add_invalid_filename(repo, ".GIT/hello");