Commit ac2fba0ecd68e8eae348dec688cbcd0828432cdf

Edward Thomson 2015-09-16T15:07:27

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
diff --git a/src/checkout.c b/src/checkout.c
index 8c06b33..2a8bfd5 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1366,7 +1366,7 @@ static int checkout_mkdir(
 	mkdir_opts.dir_map = data->mkdir_map;
 	mkdir_opts.pool = &data->pool;
 
-	error = git_futils_mkdir_ext(
+	error = git_futils_mkdir_relative(
 		path, base, mode, flags, &mkdir_opts);
 
 	data->perfdata.mkdir_calls += mkdir_opts.perfdata.mkdir_calls;
diff --git a/src/fileops.c b/src/fileops.c
index b7b5515..b986a65 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -18,7 +18,7 @@ GIT__USE_STRMAP
 int git_futils_mkpath2file(const char *file_path, const mode_t mode)
 {
 	return git_futils_mkdir(
-		file_path, NULL, mode,
+		file_path, mode,
 		GIT_MKDIR_PATH | GIT_MKDIR_SKIP_LAST | GIT_MKDIR_VERIFY_DIR);
 }
 
@@ -331,8 +331,8 @@ GIT_INLINE(int) validate_existing(
 	return 0;
 }
 
-int git_futils_mkdir_ext(
-	const char *path,
+int git_futils_mkdir_relative(
+	const char *relative_path,
 	const char *base,
 	mode_t mode,
 	uint32_t flags,
@@ -343,9 +343,13 @@ int git_futils_mkdir_ext(
 	ssize_t root = 0, min_root_len, root_len;
 	char lastch = '/', *tail;
 	struct stat st;
+	struct git_futils_mkdir_options empty_opts = {0};
+
+	if (!opts)
+		opts = &empty_opts;
 
 	/* build path and find "root" where we should start calling mkdir */
-	if (git_path_join_unrooted(&make_path, path, base, &root) < 0)
+	if (git_path_join_unrooted(&make_path, relative_path, base, &root) < 0)
 		return -1;
 
 	if (make_path.size == 0) {
@@ -503,17 +507,16 @@ done:
 
 int git_futils_mkdir(
 	const char *path,
-	const char *base,
 	mode_t mode,
 	uint32_t flags)
 {
 	struct git_futils_mkdir_options options = {0};
-	return git_futils_mkdir_ext(path, base, mode, flags, &options);
+	return git_futils_mkdir_relative(path, NULL, mode, flags, &options);
 }
 
-int git_futils_mkdir_r(const char *path, const char *base, const mode_t mode)
+int git_futils_mkdir_r(const char *path, const mode_t mode)
 {
-	return git_futils_mkdir(path, base, mode, GIT_MKDIR_PATH);
+	return git_futils_mkdir(path, mode, GIT_MKDIR_PATH);
 }
 
 typedef struct {
@@ -777,7 +780,7 @@ static int _cp_r_mkdir(cp_r_info *info, git_buf *from)
 	/* create root directory the first time we need to create a directory */
 	if ((info->flags & GIT_CPDIR__MKDIR_DONE_FOR_TO_ROOT) == 0) {
 		error = git_futils_mkdir(
-			info->to_root, NULL, info->dirmode,
+			info->to_root, info->dirmode,
 			(info->flags & GIT_CPDIR_CHMOD_DIRS) ? GIT_MKDIR_CHMOD : 0);
 
 		info->flags |= GIT_CPDIR__MKDIR_DONE_FOR_TO_ROOT;
@@ -785,9 +788,9 @@ static int _cp_r_mkdir(cp_r_info *info, git_buf *from)
 
 	/* create directory with root as base to prevent excess chmods */
 	if (!error)
-		error = git_futils_mkdir(
+		error = git_futils_mkdir_relative(
 			from->ptr + info->from_prefix, info->to_root,
-			info->dirmode, info->mkdir_flags);
+			info->dirmode, info->mkdir_flags, NULL);
 
 	return error;
 }
diff --git a/src/fileops.h b/src/fileops.h
index 0f6466c..572ff01 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -55,12 +55,9 @@ extern int git_futils_creat_locked(const char *path, const mode_t mode);
 extern int git_futils_creat_locked_withpath(const char *path, const mode_t dirmode, const mode_t mode);
 
 /**
- * Create a path recursively
- *
- * If a base parameter is being passed, it's expected to be valued with a
- * path pointing to an already existing directory.
+ * Create a path recursively.
  */
-extern int git_futils_mkdir_r(const char *path, const char *base, const mode_t mode);
+extern int git_futils_mkdir_r(const char *path, const mode_t mode);
 
 /**
  * Flags to pass to `git_futils_mkdir`.
@@ -111,20 +108,20 @@ struct git_futils_mkdir_options
  * and optionally chmods the directory immediately after (or each part of the
  * path if requested).
  *
- * @param path The path to create.
+ * @param path The path to create, relative to base.
  * @param base Root for relative path.  These directories will never be made.
  * @param mode The mode to use for created directories.
  * @param flags Combination of the mkdir flags above.
- * @param opts Extended options, use `git_futils_mkdir` if you are not interested.
+ * @param opts Extended options, or null.
  * @return 0 on success, else error code
  */
-extern int git_futils_mkdir_ext(const char *path, const char *base, mode_t mode, uint32_t flags, struct git_futils_mkdir_options *opts);
+extern int git_futils_mkdir_relative(const char *path, const char *base, mode_t mode, uint32_t flags, struct git_futils_mkdir_options *opts);
 
 /**
- * Create a directory or entire path.  Similar to `git_futils_mkdir_withperf`
+ * Create a directory or entire path.  Similar to `git_futils_mkdir_relative`
  * without performance data.
  */
-extern int git_futils_mkdir(const char *path, const char *base, mode_t mode, uint32_t flags);
+extern int git_futils_mkdir(const char *path, mode_t mode, uint32_t flags);
 
 /**
  * Create all the folders required to contain
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 99b8f7c..730c4b1 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -84,9 +84,9 @@ static int object_file_name(
 
 static int object_mkdir(const git_buf *name, const loose_backend *be)
 {
-	return git_futils_mkdir(
+	return git_futils_mkdir_relative(
 		name->ptr + be->objects_dirlen, be->objects_dir, be->object_dir_mode,
-		GIT_MKDIR_PATH | GIT_MKDIR_SKIP_LAST | GIT_MKDIR_VERIFY_DIR);
+		GIT_MKDIR_PATH | GIT_MKDIR_SKIP_LAST | GIT_MKDIR_VERIFY_DIR, NULL);
 }
 
 static size_t get_binary_object_header(obj_hdr *hdr, git_buf *obj)
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 1ddce46..921f786 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -1413,7 +1413,8 @@ static int setup_namespace(git_buf *path, git_repository *repo)
 	git__free(parts);
 
 	/* Make sure that the folder with the namespace exists */
-	if (git_futils_mkdir_r(git_buf_cstr(path), repo->path_repository, 0777) < 0)
+	if (git_futils_mkdir_relative(git_buf_cstr(path), repo->path_repository,
+			0777, GIT_MKDIR_PATH, NULL) < 0)
 		return -1;
 
 	/* Return root of the namespaced path, i.e. without the trailing '/refs' */
diff --git a/src/repository.c b/src/repository.c
index 0f37cfb..d0bf7dc 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1441,8 +1441,8 @@ static int repo_init_structure(
 			if (chmod)
 				mkdir_flags |= GIT_MKDIR_CHMOD;
 
-			error = git_futils_mkdir(
-				tpl->path, repo_dir, dmode, mkdir_flags);
+			error = git_futils_mkdir_relative(
+				tpl->path, repo_dir, dmode, mkdir_flags, NULL);
 		}
 		else if (!external_tpl) {
 			const char *content = tpl->content;
@@ -1464,7 +1464,7 @@ static int mkdir_parent(git_buf *buf, uint32_t mode, bool skip2)
 	 * don't try to set gid or grant world write access
 	 */
 	return git_futils_mkdir(
-		buf->ptr, NULL, mode & ~(S_ISGID | 0002),
+		buf->ptr, mode & ~(S_ISGID | 0002),
 		GIT_MKDIR_PATH | GIT_MKDIR_VERIFY_DIR |
 		(skip2 ? GIT_MKDIR_SKIP_LAST2 : GIT_MKDIR_SKIP_LAST));
 }
@@ -1568,14 +1568,14 @@ static int repo_init_directories(
 		/* create path #4 */
 		if (wd_path->size > 0 &&
 			(error = git_futils_mkdir(
-				wd_path->ptr, NULL, dirmode & ~S_ISGID,
+				wd_path->ptr, dirmode & ~S_ISGID,
 				GIT_MKDIR_VERIFY_DIR)) < 0)
 			return error;
 
 		/* create path #2 (if not the same as #4) */
 		if (!natural_wd &&
 			(error = git_futils_mkdir(
-				repo_path->ptr, NULL, dirmode & ~S_ISGID,
+				repo_path->ptr, dirmode & ~S_ISGID,
 				GIT_MKDIR_VERIFY_DIR | GIT_MKDIR_SKIP_LAST)) < 0)
 			return error;
 	}
@@ -1585,7 +1585,7 @@ static int repo_init_directories(
 		has_dotgit)
 	{
 		/* create path #1 */
-		error = git_futils_mkdir(repo_path->ptr, NULL, dirmode,
+		error = git_futils_mkdir(repo_path->ptr, dirmode,
 			GIT_MKDIR_VERIFY_DIR | ((dirmode & S_ISGID) ? GIT_MKDIR_CHMOD : 0));
 	}
 
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index 0d220e1..9fa9018 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 4481308..b5e83fe 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 0e7026a..9872af7 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 04b2dfa..967748c 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 f76fe1d..e435a9a 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 bd9b990..ef2e45a 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 2a416fc..1498196 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 c75f6fe..b5c0e79 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 7dfaf6d..bda86f6 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 7904b64..86bd745 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 929d741..7a9ec20 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 9c4cc9e..83b8246 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 eb459e5..d3d0872 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 bbf8f49..c318046 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 75c7b71..fc4afc6 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 5f4e620..10f385c 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");