aboutsummaryrefslogtreecommitdiffstats
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-04-15 11:38:15 +0200
committerJunio C Hamano <gitster@pobox.com>2025-04-15 08:24:35 -0700
commit1a99fe8010642a71063536510c578c1543d763b4 (patch)
tree1151da975bf092257d71b0c4420056265e9be0f8 /merge-recursive.c
parentobject-file: move `mkdir_in_gitdir()` into "path.c" (diff)
downloadgit-1a99fe8010642a71063536510c578c1543d763b4.tar.gz
git-1a99fe8010642a71063536510c578c1543d763b4.zip
object-file: move `safe_create_leading_directories()` into "path.c"
The `safe_create_leading_directories()` function and its relatives are located in "object-file.c", which is not a good fit as they provide generic functionality not related to objects at all. Move them into "path.c", which already hosts `safe_create_dir()` and its relative `safe_create_dir_in_gitdir()`. "path.c" is free of `the_repository`, but the moved functions depend on `the_repository` to read the "core.sharedRepository" config. Adapt the function signature to accept a repository as argument to fix the issue and adjust callers accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 9aedffc546..f71490517e 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -910,7 +910,7 @@ static int make_room_for_path(struct merge_options *opt, const char *path)
}
/* Make sure leading directories are created */
- status = safe_create_leading_directories_const(path);
+ status = safe_create_leading_directories_const(the_repository, path);
if (status) {
if (status == SCLD_EXISTS)
/* something else exists */
@@ -1003,7 +1003,7 @@ static int update_file_flags(struct merge_options *opt,
close(fd);
} else if (S_ISLNK(contents->mode)) {
char *lnk = xmemdupz(buf, size);
- safe_create_leading_directories_const(path);
+ safe_create_leading_directories_const(the_repository, path);
unlink(path);
if (symlink(lnk, path))
ret = err(opt, _("failed to symlink '%s': %s"),