summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-09-16 15:07:27 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2015-09-17 10:00:35 -0400
commitac2fba0ecd68e8eae348dec688cbcd0828432cdf (patch)
tree35921227c4eae6e36a65a90e391966319d9676b2 /tests
parentadd0378d8eb76cb7fde92bcbed3eb59ee5b8947c (diff)
downloadlibgit2-ac2fba0ecd68e8eae348dec688cbcd0828432cdf.tar.gz
git_futils_mkdir_*: make a relative-to-base mkdir
Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter assumes that we own everything beneath the base, as if it were being called with a base of the repository or working directory, and is tailored towards checkout and ensuring that there is no bogosity beneath the base that must be cleaned up. This is (at best) slow and (at worst) unsafe in the larger context of a filesystem where we do not own things and cannot do things like unlink symlinks that are in our way.
Diffstat (limited to 'tests')
-rw-r--r--tests/checkout/index.c2
-rw-r--r--tests/config/global.c6
-rw-r--r--tests/core/buffer.c2
-rw-r--r--tests/core/copy.c8
-rw-r--r--tests/core/mkdir.c54
-rw-r--r--tests/core/stat.c2
-rw-r--r--tests/index/tests.c2
-rw-r--r--tests/odb/alternates.c2
-rw-r--r--tests/refs/pack.c2
-rw-r--r--tests/repo/discover.c16
-rw-r--r--tests/repo/init.c6
-rw-r--r--tests/repo/iterator.c6
-rw-r--r--tests/repo/open.c4
-rw-r--r--tests/status/ignore.c14
-rw-r--r--tests/status/worktree.c10
-rw-r--r--tests/submodule/status.c10
16 files changed, 73 insertions, 73 deletions
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index 0d220e141..9fa901867 100644
--- a/tests/checkout/index.c
+++ b/tests/checkout/index.c
@@ -63,7 +63,7 @@ void test_checkout_index__can_remove_untracked_files(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- git_futils_mkdir("./testrepo/dir/subdir/subsubdir", NULL, 0755, GIT_MKDIR_PATH);
+ git_futils_mkdir("./testrepo/dir/subdir/subsubdir", 0755, GIT_MKDIR_PATH);
cl_git_mkfile("./testrepo/dir/one", "one\n");
cl_git_mkfile("./testrepo/dir/subdir/two", "two\n");
diff --git a/tests/config/global.c b/tests/config/global.c
index 4481308d6..b5e83fec0 100644
--- a/tests/config/global.c
+++ b/tests/config/global.c
@@ -6,17 +6,17 @@ void test_config_global__initialize(void)
{
git_buf path = GIT_BUF_INIT;
- cl_git_pass(git_futils_mkdir_r("home", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("home", 0777));
cl_git_pass(git_path_prettify(&path, "home", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr));
- cl_git_pass(git_futils_mkdir_r("xdg/git", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("xdg/git", 0777));
cl_git_pass(git_path_prettify(&path, "xdg/git", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr));
- cl_git_pass(git_futils_mkdir_r("etc", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("etc", 0777));
cl_git_pass(git_path_prettify(&path, "etc", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, path.ptr));
diff --git a/tests/core/buffer.c b/tests/core/buffer.c
index 0e7026a9c..9872af7f4 100644
--- a/tests/core/buffer.c
+++ b/tests/core/buffer.c
@@ -929,7 +929,7 @@ void test_core_buffer__similarity_metric(void)
cl_git_pass(git_buf_sets(&buf, SIMILARITY_TEST_DATA_1));
cl_git_pass(git_hashsig_create(&a, buf.ptr, buf.size, GIT_HASHSIG_NORMAL));
- cl_git_pass(git_futils_mkdir("scratch", NULL, 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("scratch", 0755, GIT_MKDIR_PATH));
cl_git_mkfile("scratch/testdata", SIMILARITY_TEST_DATA_1);
cl_git_pass(git_hashsig_create_fromfile(
&b, "scratch/testdata", GIT_HASHSIG_NORMAL));
diff --git a/tests/core/copy.c b/tests/core/copy.c
index 04b2dfab5..967748cc5 100644
--- a/tests/core/copy.c
+++ b/tests/core/copy.c
@@ -25,7 +25,7 @@ void test_core_copy__file_in_dir(void)
struct stat st;
const char *content = "This is some other stuff to copy\n";
- cl_git_pass(git_futils_mkdir("an_dir/in_a_dir", NULL, 0775, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("an_dir/in_a_dir", 0775, GIT_MKDIR_PATH));
cl_git_mkfile("an_dir/in_a_dir/copy_me", content);
cl_assert(git_path_isdir("an_dir"));
@@ -60,9 +60,9 @@ void test_core_copy__tree(void)
struct stat st;
const char *content = "File content\n";
- cl_git_pass(git_futils_mkdir("src/b", NULL, 0775, GIT_MKDIR_PATH));
- cl_git_pass(git_futils_mkdir("src/c/d", NULL, 0775, GIT_MKDIR_PATH));
- cl_git_pass(git_futils_mkdir("src/c/e", NULL, 0775, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("src/b", 0775, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("src/c/d", 0775, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("src/c/e", 0775, GIT_MKDIR_PATH));
cl_git_mkfile("src/f1", content);
cl_git_mkfile("src/b/f2", content);
diff --git a/tests/core/mkdir.c b/tests/core/mkdir.c
index f76fe1da9..e435a9a64 100644
--- a/tests/core/mkdir.c
+++ b/tests/core/mkdir.c
@@ -19,37 +19,37 @@ void test_core_mkdir__basic(void)
/* make a directory */
cl_assert(!git_path_isdir("d0"));
- cl_git_pass(git_futils_mkdir("d0", NULL, 0755, 0));
+ cl_git_pass(git_futils_mkdir("d0", 0755, 0));
cl_assert(git_path_isdir("d0"));
/* make a path */
cl_assert(!git_path_isdir("d1"));
- cl_git_pass(git_futils_mkdir("d1/d1.1/d1.2", NULL, 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("d1/d1.1/d1.2", 0755, GIT_MKDIR_PATH));
cl_assert(git_path_isdir("d1"));
cl_assert(git_path_isdir("d1/d1.1"));
cl_assert(git_path_isdir("d1/d1.1/d1.2"));
/* make a dir exclusively */
cl_assert(!git_path_isdir("d2"));
- cl_git_pass(git_futils_mkdir("d2", NULL, 0755, GIT_MKDIR_EXCL));
+ cl_git_pass(git_futils_mkdir("d2", 0755, GIT_MKDIR_EXCL));
cl_assert(git_path_isdir("d2"));
/* make exclusive failure */
- cl_git_fail(git_futils_mkdir("d2", NULL, 0755, GIT_MKDIR_EXCL));
+ cl_git_fail(git_futils_mkdir("d2", 0755, GIT_MKDIR_EXCL));
/* make a path exclusively */
cl_assert(!git_path_isdir("d3"));
- cl_git_pass(git_futils_mkdir("d3/d3.1/d3.2", NULL, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
+ cl_git_pass(git_futils_mkdir("d3/d3.1/d3.2", 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
cl_assert(git_path_isdir("d3"));
cl_assert(git_path_isdir("d3/d3.1/d3.2"));
/* make exclusive path failure */
- cl_git_fail(git_futils_mkdir("d3/d3.1/d3.2", NULL, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
+ cl_git_fail(git_futils_mkdir("d3/d3.1/d3.2", 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
/* ??? Should EXCL only apply to the last item in the path? */
/* path with trailing slash? */
cl_assert(!git_path_isdir("d4"));
- cl_git_pass(git_futils_mkdir("d4/d4.1/", NULL, 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("d4/d4.1/", 0755, GIT_MKDIR_PATH));
cl_assert(git_path_isdir("d4/d4.1"));
}
@@ -65,38 +65,38 @@ void test_core_mkdir__with_base(void)
cl_set_cleanup(cleanup_basedir, NULL);
- cl_git_pass(git_futils_mkdir(BASEDIR, NULL, 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir(BASEDIR, 0755, GIT_MKDIR_PATH));
- cl_git_pass(git_futils_mkdir("a", BASEDIR, 0755, 0));
+ cl_git_pass(git_futils_mkdir_relative("a", BASEDIR, 0755, 0, NULL));
cl_assert(git_path_isdir(BASEDIR "/a"));
- cl_git_pass(git_futils_mkdir("b/b1/b2", BASEDIR, 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir_relative("b/b1/b2", BASEDIR, 0755, GIT_MKDIR_PATH, NULL));
cl_assert(git_path_isdir(BASEDIR "/b/b1/b2"));
/* exclusive with existing base */
- cl_git_pass(git_futils_mkdir("c/c1/c2", BASEDIR, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
+ cl_git_pass(git_futils_mkdir_relative("c/c1/c2", BASEDIR, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL, NULL));
/* fail: exclusive with duplicated suffix */
- cl_git_fail(git_futils_mkdir("c/c1/c3", BASEDIR, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
+ cl_git_fail(git_futils_mkdir_relative("c/c1/c3", BASEDIR, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL, NULL));
/* fail: exclusive with any duplicated component */
- cl_git_fail(git_futils_mkdir("c/cz/cz", BASEDIR, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
+ cl_git_fail(git_futils_mkdir_relative("c/cz/cz", BASEDIR, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL, NULL));
/* success: exclusive without path */
- cl_git_pass(git_futils_mkdir("c/c1/c3", BASEDIR, 0755, GIT_MKDIR_EXCL));
+ cl_git_pass(git_futils_mkdir_relative("c/c1/c3", BASEDIR, 0755, GIT_MKDIR_EXCL, NULL));
/* path with shorter base and existing dirs */
- cl_git_pass(git_futils_mkdir("dir/here/d/", "base", 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir_relative("dir/here/d/", "base", 0755, GIT_MKDIR_PATH, NULL));
cl_assert(git_path_isdir("base/dir/here/d"));
/* fail: path with shorter base and existing dirs */
- cl_git_fail(git_futils_mkdir("dir/here/e/", "base", 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
+ cl_git_fail(git_futils_mkdir_relative("dir/here/e/", "base", 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL, NULL));
/* fail: base with missing components */
- cl_git_fail(git_futils_mkdir("f/", "base/missing", 0755, GIT_MKDIR_PATH));
+ cl_git_fail(git_futils_mkdir_relative("f/", "base/missing", 0755, GIT_MKDIR_PATH, NULL));
/* success: shift missing component to path */
- cl_git_pass(git_futils_mkdir("missing/f/", "base/", 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir_relative("missing/f/", "base/", 0755, GIT_MKDIR_PATH, NULL));
}
static void cleanup_chmod_root(void *ref)
@@ -135,9 +135,9 @@ void test_core_mkdir__chmods(void)
cl_set_cleanup(cleanup_chmod_root, old);
- cl_git_pass(git_futils_mkdir("r", NULL, 0777, 0));
+ cl_git_pass(git_futils_mkdir("r", 0777, 0));
- cl_git_pass(git_futils_mkdir("mode/is/important", "r", 0777, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir_relative("mode/is/important", "r", 0777, GIT_MKDIR_PATH, NULL));
cl_git_pass(git_path_lstat("r/mode", &st));
check_mode(0755, st.st_mode);
@@ -146,7 +146,7 @@ void test_core_mkdir__chmods(void)
cl_git_pass(git_path_lstat("r/mode/is/important", &st));
check_mode(0755, st.st_mode);
- cl_git_pass(git_futils_mkdir("mode2/is2/important2", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD));
+ cl_git_pass(git_futils_mkdir_relative("mode2/is2/important2", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD, NULL));
cl_git_pass(git_path_lstat("r/mode2", &st));
check_mode(0755, st.st_mode);
@@ -155,7 +155,7 @@ void test_core_mkdir__chmods(void)
cl_git_pass(git_path_lstat("r/mode2/is2/important2", &st));
check_mode(0777, st.st_mode);
- cl_git_pass(git_futils_mkdir("mode3/is3/important3", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD_PATH));
+ cl_git_pass(git_futils_mkdir_relative("mode3/is3/important3", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD_PATH, NULL));
cl_git_pass(git_path_lstat("r/mode3", &st));
check_mode(0777, st.st_mode);
@@ -166,7 +166,7 @@ void test_core_mkdir__chmods(void)
/* test that we chmod existing dir */
- cl_git_pass(git_futils_mkdir("mode/is/important", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD));
+ cl_git_pass(git_futils_mkdir_relative("mode/is/important", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD, NULL));
cl_git_pass(git_path_lstat("r/mode", &st));
check_mode(0755, st.st_mode);
@@ -177,7 +177,7 @@ void test_core_mkdir__chmods(void)
/* test that we chmod even existing dirs if CHMOD_PATH is set */
- cl_git_pass(git_futils_mkdir("mode2/is2/important2.1", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD_PATH));
+ cl_git_pass(git_futils_mkdir_relative("mode2/is2/important2.1", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD_PATH, NULL));
cl_git_pass(git_path_lstat("r/mode2", &st));
check_mode(0777, st.st_mode);
@@ -200,8 +200,8 @@ void test_core_mkdir__mkdir_path_inside_unwriteable_parent(void)
*old = p_umask(022);
cl_set_cleanup(cleanup_chmod_root, old);
- cl_git_pass(git_futils_mkdir("r", NULL, 0777, 0));
- cl_git_pass(git_futils_mkdir("mode/is/important", "r", 0777, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("r", 0777, 0));
+ cl_git_pass(git_futils_mkdir_relative("mode/is/important", "r", 0777, GIT_MKDIR_PATH, NULL));
cl_git_pass(git_path_lstat("r/mode", &st));
check_mode(0755, st.st_mode);
@@ -210,7 +210,7 @@ void test_core_mkdir__mkdir_path_inside_unwriteable_parent(void)
check_mode(0111, st.st_mode);
cl_git_pass(
- git_futils_mkdir("mode/is/okay/inside", "r", 0777, GIT_MKDIR_PATH));
+ git_futils_mkdir_relative("mode/is/okay/inside", "r", 0777, GIT_MKDIR_PATH, NULL));
cl_git_pass(git_path_lstat("r/mode/is/okay/inside", &st));
check_mode(0755, st.st_mode);
diff --git a/tests/core/stat.c b/tests/core/stat.c
index bd9b990e3..ef2e45a15 100644
--- a/tests/core/stat.c
+++ b/tests/core/stat.c
@@ -5,7 +5,7 @@
void test_core_stat__initialize(void)
{
- cl_git_pass(git_futils_mkdir("root/d1/d2", NULL, 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("root/d1/d2", 0755, GIT_MKDIR_PATH));
cl_git_mkfile("root/file", "whatever\n");
cl_git_mkfile("root/d1/file", "whatever\n");
}
diff --git a/tests/index/tests.c b/tests/index/tests.c
index 2a416fc7b..1498196b2 100644
--- a/tests/index/tests.c
+++ b/tests/index/tests.c
@@ -752,7 +752,7 @@ void test_index_tests__reload_from_disk(void)
cl_set_cleanup(&cleanup_myrepo, NULL);
- cl_git_pass(git_futils_mkdir("./myrepo", NULL, 0777, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir("./myrepo", 0777, GIT_MKDIR_PATH));
cl_git_mkfile("./myrepo/a.txt", "a\n");
cl_git_mkfile("./myrepo/b.txt", "b\n");
diff --git a/tests/odb/alternates.c b/tests/odb/alternates.c
index c75f6feaa..b5c0e79c0 100644
--- a/tests/odb/alternates.c
+++ b/tests/odb/alternates.c
@@ -29,7 +29,7 @@ static void init_linked_repo(const char *path, const char *alternate)
cl_git_pass(git_path_prettify(&destpath, alternate, NULL));
cl_git_pass(git_buf_joinpath(&destpath, destpath.ptr, "objects"));
cl_git_pass(git_buf_joinpath(&filepath, git_repository_path(repo), "objects/info"));
- cl_git_pass(git_futils_mkdir(filepath.ptr, NULL, 0755, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir(filepath.ptr, 0755, GIT_MKDIR_PATH));
cl_git_pass(git_buf_joinpath(&filepath, filepath.ptr , "alternates"));
cl_git_pass(git_filebuf_open(&file, git_buf_cstr(&filepath), 0, 0666));
diff --git a/tests/refs/pack.c b/tests/refs/pack.c
index 7dfaf6d8f..bda86f69a 100644
--- a/tests/refs/pack.c
+++ b/tests/refs/pack.c
@@ -36,7 +36,7 @@ void test_refs_pack__empty(void)
git_buf temp_path = GIT_BUF_INIT;
cl_git_pass(git_buf_join_n(&temp_path, '/', 3, git_repository_path(g_repo), GIT_REFS_HEADS_DIR, "empty_dir"));
- cl_git_pass(git_futils_mkdir_r(temp_path.ptr, NULL, GIT_REFS_DIR_MODE));
+ cl_git_pass(git_futils_mkdir_r(temp_path.ptr, GIT_REFS_DIR_MODE));
git_buf_free(&temp_path);
packall();
diff --git a/tests/repo/discover.c b/tests/repo/discover.c
index 7904b6496..86bd7458f 100644
--- a/tests/repo/discover.c
+++ b/tests/repo/discover.c
@@ -77,7 +77,7 @@ void test_repo_discover__0(void)
const char *ceiling_dirs;
const mode_t mode = 0777;
- git_futils_mkdir_r(DISCOVER_FOLDER, NULL, mode);
+ git_futils_mkdir_r(DISCOVER_FOLDER, mode);
append_ceiling_dir(&ceiling_dirs_buf, TEMP_REPO_FOLDER);
ceiling_dirs = git_buf_cstr(&ceiling_dirs_buf);
@@ -88,15 +88,15 @@ void test_repo_discover__0(void)
git_repository_free(repo);
cl_git_pass(git_repository_init(&repo, SUB_REPOSITORY_FOLDER, 0));
- cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
+ cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, mode));
cl_git_pass(git_repository_discover(&sub_repository_path, SUB_REPOSITORY_FOLDER, 0, ceiling_dirs));
- cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
+ cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, mode));
ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB, ceiling_dirs, &sub_repository_path);
ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB, ceiling_dirs, &sub_repository_path);
ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, ceiling_dirs, &sub_repository_path);
- cl_git_pass(git_futils_mkdir_r(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, NULL, mode));
+ cl_git_pass(git_futils_mkdir_r(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, mode));
write_file(REPOSITORY_ALTERNATE_FOLDER "/" DOT_GIT, "gitdir: ../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT);
write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB "/" DOT_GIT, "gitdir: ../../../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT);
write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB "/" DOT_GIT, "gitdir: ../../../../");
@@ -105,13 +105,13 @@ void test_repo_discover__0(void)
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB, ceiling_dirs, &sub_repository_path);
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, ceiling_dirs, &repository_path);
- cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER1, NULL, mode));
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER1, mode));
write_file(ALTERNATE_MALFORMED_FOLDER1 "/" DOT_GIT, "Anything but not gitdir:");
- cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER2, NULL, mode));
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER2, mode));
write_file(ALTERNATE_MALFORMED_FOLDER2 "/" DOT_GIT, "gitdir:");
- cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER3, NULL, mode));
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER3, mode));
write_file(ALTERNATE_MALFORMED_FOLDER3 "/" DOT_GIT, "gitdir: \n\n\n");
- cl_git_pass(git_futils_mkdir_r(ALTERNATE_NOT_FOUND_FOLDER, NULL, mode));
+ cl_git_pass(git_futils_mkdir_r(ALTERNATE_NOT_FOUND_FOLDER, mode));
write_file(ALTERNATE_NOT_FOUND_FOLDER "/" DOT_GIT, "gitdir: a_repository_that_surely_does_not_exist");
cl_git_fail(git_repository_discover(&found_path, ALTERNATE_MALFORMED_FOLDER1, 0, ceiling_dirs));
cl_git_fail(git_repository_discover(&found_path, ALTERNATE_MALFORMED_FOLDER2, 0, ceiling_dirs));
diff --git a/tests/repo/init.c b/tests/repo/init.c
index 929d74180..7a9ec20f1 100644
--- a/tests/repo/init.c
+++ b/tests/repo/init.c
@@ -99,7 +99,7 @@ void test_repo_init__bare_repo_escaping_current_workdir(void)
cl_git_pass(git_path_prettify_dir(&path_current_workdir, ".", NULL));
cl_git_pass(git_buf_joinpath(&path_repository, git_buf_cstr(&path_current_workdir), "a/b/c"));
- cl_git_pass(git_futils_mkdir_r(git_buf_cstr(&path_repository), NULL, GIT_DIR_MODE));
+ cl_git_pass(git_futils_mkdir_r(git_buf_cstr(&path_repository), GIT_DIR_MODE));
/* Change the current working directory */
cl_git_pass(chdir(git_buf_cstr(&path_repository)));
@@ -312,7 +312,7 @@ void test_repo_init__extended_0(void)
cl_git_fail(git_repository_init_ext(&_repo, "extended", &opts));
/* make the directory first, then it should succeed */
- cl_git_pass(git_futils_mkdir("extended", NULL, 0775, 0));
+ cl_git_pass(git_futils_mkdir("extended", 0775, 0));
cl_git_pass(git_repository_init_ext(&_repo, "extended", &opts));
cl_assert(!git__suffixcmp(git_repository_workdir(_repo), "/extended/"));
@@ -631,7 +631,7 @@ void test_repo_init__can_reinit_an_initialized_repository(void)
cl_set_cleanup(&cleanup_repository, "extended");
- cl_git_pass(git_futils_mkdir("extended", NULL, 0775, 0));
+ cl_git_pass(git_futils_mkdir("extended", 0775, 0));
cl_git_pass(git_repository_init(&_repo, "extended", false));
cl_git_pass(git_repository_init(&reinit, "extended", false));
diff --git a/tests/repo/iterator.c b/tests/repo/iterator.c
index 9c4cc9ea4..83b824691 100644
--- a/tests/repo/iterator.c
+++ b/tests/repo/iterator.c
@@ -848,14 +848,14 @@ static void build_workdir_tree(const char *root, int dirs, int subs)
for (i = 0; i < dirs; ++i) {
if (i % 2 == 0) {
p_snprintf(buf, sizeof(buf), "%s/dir%02d", root, i);
- cl_git_pass(git_futils_mkdir(buf, NULL, 0775, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir(buf, 0775, GIT_MKDIR_PATH));
p_snprintf(buf, sizeof(buf), "%s/dir%02d/file", root, i);
cl_git_mkfile(buf, buf);
buf[strlen(buf) - 5] = '\0';
} else {
p_snprintf(buf, sizeof(buf), "%s/DIR%02d", root, i);
- cl_git_pass(git_futils_mkdir(buf, NULL, 0775, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir(buf, 0775, GIT_MKDIR_PATH));
}
for (j = 0; j < subs; ++j) {
@@ -865,7 +865,7 @@ static void build_workdir_tree(const char *root, int dirs, int subs)
case 2: p_snprintf(sub, sizeof(sub), "%s/Sub%02d", buf, j); break;
case 3: p_snprintf(sub, sizeof(sub), "%s/SUB%02d", buf, j); break;
}
- cl_git_pass(git_futils_mkdir(sub, NULL, 0775, GIT_MKDIR_PATH));
+ cl_git_pass(git_futils_mkdir(sub, 0775, GIT_MKDIR_PATH));
if (j % 2 == 0) {
size_t sublen = strlen(sub);
diff --git a/tests/repo/open.c b/tests/repo/open.c
index eb459e51d..d3d087231 100644
--- a/tests/repo/open.c
+++ b/tests/repo/open.c
@@ -91,7 +91,7 @@ static void make_gitlink_dir(const char *dir, const char *linktext)
{
git_buf path = GIT_BUF_INIT;
- cl_git_pass(git_futils_mkdir(dir, NULL, 0777, GIT_MKDIR_VERIFY_DIR));
+ cl_git_pass(git_futils_mkdir(dir, 0777, GIT_MKDIR_VERIFY_DIR));
cl_git_pass(git_buf_joinpath(&path, dir, ".git"));
cl_git_rewritefile(path.ptr, linktext);
git_buf_free(&path);
@@ -222,7 +222,7 @@ void test_repo_open__bad_gitlinks(void)
cl_git_sandbox_init("attr");
cl_git_pass(p_mkdir("invalid", 0777));
- cl_git_pass(git_futils_mkdir_r("invalid2/.git", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("invalid2/.git", 0777));
for (scan = bad_links; *scan != NULL; scan++) {
make_gitlink_dir("alternate", *scan);
diff --git a/tests/status/ignore.c b/tests/status/ignore.c
index bbf8f4911..c318046da 100644
--- a/tests/status/ignore.c
+++ b/tests/status/ignore.c
@@ -148,7 +148,7 @@ void test_status_ignore__ignore_pattern_contains_space(void)
cl_git_pass(git_status_file(&flags, g_repo, "foo bar.txt"));
cl_assert(flags == GIT_STATUS_IGNORED);
- cl_git_pass(git_futils_mkdir_r("empty_standard_repo/foo", NULL, mode));
+ cl_git_pass(git_futils_mkdir_r("empty_standard_repo/foo", mode));
cl_git_mkfile("empty_standard_repo/foo/look-ma.txt", "I'm not going to be ignored!");
cl_git_pass(git_status_file(&flags, g_repo, "foo/look-ma.txt"));
@@ -206,7 +206,7 @@ void test_status_ignore__subdirectories(void)
* used a rooted path for an ignore, so I changed this behavior.
*/
cl_git_pass(git_futils_mkdir_r(
- "empty_standard_repo/test/ignore_me", NULL, 0775));
+ "empty_standard_repo/test/ignore_me", 0775));
cl_git_mkfile(
"empty_standard_repo/test/ignore_me/file", "I'm going to be ignored!");
cl_git_mkfile(
@@ -230,9 +230,9 @@ static void make_test_data(const char *reponame, const char **files)
g_repo = cl_git_sandbox_init(reponame);
for (scan = files; *scan != NULL; ++scan) {
- cl_git_pass(git_futils_mkdir(
+ cl_git_pass(git_futils_mkdir_relative(
*scan + repolen, reponame,
- 0777, GIT_MKDIR_PATH | GIT_MKDIR_SKIP_LAST));
+ 0777, GIT_MKDIR_PATH | GIT_MKDIR_SKIP_LAST, NULL));
cl_git_mkfile(*scan, "contents");
}
}
@@ -612,7 +612,7 @@ void test_status_ignore__issue_1766_negated_ignores(void)
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_pass(git_futils_mkdir_r(
- "empty_standard_repo/a", NULL, 0775));
+ "empty_standard_repo/a", 0775));
cl_git_mkfile(
"empty_standard_repo/a/.gitignore", "*\n!.gitignore\n");
cl_git_mkfile(
@@ -622,7 +622,7 @@ void test_status_ignore__issue_1766_negated_ignores(void)
assert_is_ignored("a/ignoreme");
cl_git_pass(git_futils_mkdir_r(
- "empty_standard_repo/b", NULL, 0775));
+ "empty_standard_repo/b", 0775));
cl_git_mkfile(
"empty_standard_repo/b/.gitignore", "*\n!.gitignore\n");
cl_git_mkfile(
@@ -1033,7 +1033,7 @@ void test_status_ignore__negate_starstar(void)
"code/projects/**/packages/*\n"
"!code/projects/**/packages/repositories.config");
- cl_git_pass(git_futils_mkdir_r("code/projects/foo/bar/packages", "empty_standard_repo", 0777));
+ cl_git_pass(git_futils_mkdir_r("empty_standard_repo/code/projects/foo/bar/packages", 0777));
cl_git_mkfile("empty_standard_repo/code/projects/foo/bar/packages/repositories.config", "");
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "code/projects/foo/bar/packages/repositories.config"));
diff --git a/tests/status/worktree.c b/tests/status/worktree.c
index 75c7b71b0..fc4afc6be 100644
--- a/tests/status/worktree.c
+++ b/tests/status/worktree.c
@@ -195,7 +195,7 @@ void test_status_worktree__swap_subdir_with_recurse_and_pathspec(void)
cl_git_pass(p_rename("status/subdir", "status/current_file"));
cl_git_pass(p_rename("status/swap", "status/subdir"));
cl_git_mkfile("status/.new_file", "dummy");
- cl_git_pass(git_futils_mkdir_r("status/zzz_new_dir", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("status/zzz_new_dir", 0777));
cl_git_mkfile("status/zzz_new_dir/new_file", "dummy");
cl_git_mkfile("status/zzz_new_file", "dummy");
@@ -917,7 +917,7 @@ void test_status_worktree__long_filenames(void)
// Create directory with amazingly long filename
sprintf(path, "empty_standard_repo/%s", longname);
- cl_git_pass(git_futils_mkdir_r(path, NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r(path, 0777));
sprintf(path, "empty_standard_repo/%s/foo", longname);
cl_git_mkfile(path, "dummy");
@@ -1007,7 +1007,7 @@ void test_status_worktree__unreadable(void)
status_entry_counts counts = {0};
/* Create directory with no read permission */
- cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", 0777));
cl_git_mkfile("empty_standard_repo/no_permission/foo", "dummy");
p_chmod("empty_standard_repo/no_permission", 0644);
@@ -1041,7 +1041,7 @@ void test_status_worktree__unreadable_not_included(void)
status_entry_counts counts = {0};
/* Create directory with no read permission */
- cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", 0777));
cl_git_mkfile("empty_standard_repo/no_permission/foo", "dummy");
p_chmod("empty_standard_repo/no_permission", 0644);
@@ -1074,7 +1074,7 @@ void test_status_worktree__unreadable_as_untracked(void)
status_entry_counts counts = {0};
/* Create directory with no read permission */
- cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", NULL, 0777));
+ cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", 0777));
cl_git_mkfile("empty_standard_repo/no_permission/foo", "dummy");
p_chmod("empty_standard_repo/no_permission", 0644);
diff --git a/tests/submodule/status.c b/tests/submodule/status.c
index 5f4e62053..10f385ce9 100644
--- a/tests/submodule/status.c
+++ b/tests/submodule/status.c
@@ -92,7 +92,7 @@ void test_submodule_status__ignore_none(void)
cl_assert((status & GIT_SUBMODULE_STATUS_WD_DELETED) != 0);
/* now mkdir sm_unchanged to test uninitialized */
- cl_git_pass(git_futils_mkdir("sm_unchanged", "submod2", 0755, 0));
+ cl_git_pass(git_futils_mkdir_relative("sm_unchanged", "submod2", 0755, 0, NULL));
status = get_submodule_status(g_repo, "sm_unchanged");
cl_assert((status & GIT_SUBMODULE_STATUS_WD_UNINITIALIZED) != 0);
@@ -141,7 +141,7 @@ void test_submodule_status__ignore_untracked(void)
cl_assert((status & GIT_SUBMODULE_STATUS_WD_DELETED) != 0);
/* now mkdir sm_unchanged to test uninitialized */
- cl_git_pass(git_futils_mkdir("sm_unchanged", "submod2", 0755, 0));
+ cl_git_pass(git_futils_mkdir_relative("sm_unchanged", "submod2", 0755, 0, NULL));
cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
cl_assert((status & GIT_SUBMODULE_STATUS_WD_UNINITIALIZED) != 0);
@@ -185,7 +185,7 @@ void test_submodule_status__ignore_dirty(void)
cl_assert((status & GIT_SUBMODULE_STATUS_WD_DELETED) != 0);
/* now mkdir sm_unchanged to test uninitialized */
- cl_git_pass(git_futils_mkdir("sm_unchanged", "submod2", 0755, 0));
+ cl_git_pass(git_futils_mkdir_relative("sm_unchanged", "submod2", 0755, 0, NULL));
cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
cl_assert((status & GIT_SUBMODULE_STATUS_WD_UNINITIALIZED) != 0);
@@ -229,7 +229,7 @@ void test_submodule_status__ignore_all(void)
cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
/* now mkdir sm_unchanged to test uninitialized */
- cl_git_pass(git_futils_mkdir("sm_unchanged", "submod2", 0755, 0));
+ cl_git_pass(git_futils_mkdir_relative("sm_unchanged", "submod2", 0755, 0, NULL));
cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
@@ -338,7 +338,7 @@ void test_submodule_status__untracked_dirs_containing_ignored_files(void)
"submod2/.git/modules/sm_unchanged/info/exclude", "\n*.ignored\n");
cl_git_pass(
- git_futils_mkdir("sm_unchanged/directory", "submod2", 0755, 0));
+ git_futils_mkdir_relative("sm_unchanged/directory", "submod2", 0755, 0, NULL));
cl_git_mkfile(
"submod2/sm_unchanged/directory/i_am.ignored",
"ignore this file, please\n");