summaryrefslogtreecommitdiff
path: root/src/fileops.h
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/fileops.h
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/fileops.h')
-rw-r--r--src/fileops.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/fileops.h b/src/fileops.h
index 0f6466c59..572ff01a5 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