mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
d1fa670de0
commit
1a99fe8010
@@ -2,8 +2,8 @@
|
||||
#include "builtin.h"
|
||||
#include "abspath.h"
|
||||
#include "gettext.h"
|
||||
#include "object-file.h"
|
||||
#include "parse-options.h"
|
||||
#include "path.h"
|
||||
|
||||
#ifndef NO_UNIX_SOCKETS
|
||||
|
||||
@@ -271,7 +271,7 @@ static void init_socket_directory(const char *path)
|
||||
* condition in which somebody can chdir to it, sleep, then try to open
|
||||
* our protected socket.
|
||||
*/
|
||||
if (safe_create_leading_directories_const(dir) < 0)
|
||||
if (safe_create_leading_directories_const(the_repository, dir) < 0)
|
||||
die_errno("unable to create directories for '%s'", dir);
|
||||
if (mkdir(dir, 0700) < 0)
|
||||
die_errno("unable to mkdir '%s'", dir);
|
||||
|
||||
Reference in New Issue
Block a user