summaryrefslogtreecommitdiff
path: root/src/repository.c
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 /src/repository.c
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 'src/repository.c')
-rw-r--r--src/repository.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/repository.c b/src/repository.c
index 0f37cfbfe..d0bf7dc79 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));
}