summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-07-26 16:07:01 -0700
committerRussell Belfer <rb@github.com>2012-08-22 16:06:22 -0700
commit662880ca60e4d1662bb10648522242ac54797720 (patch)
tree8076f921e5a02c540f2ccf3358715be985c6f392 /src/fileops.c
parent5fdc41e76591aebdbae3b49440bc2c8b2430718c (diff)
downloadlibgit2-662880ca60e4d1662bb10648522242ac54797720.tar.gz
Add git_repository_init_ext for power initters
The extended version of repository init adds support for many of the things that you can do with `git init` and sets up structures that will make it easier to extend further in the future.
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fileops.c b/src/fileops.c
index 4de58b0cc..70c5c387c 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -239,6 +239,16 @@ void git_futils_mmap_free(git_map *out)
p_munmap(out);
}
+int git_futils_mkdir_q(const char *path, const mode_t mode)
+{
+ if (p_mkdir(path, mode) < 0 && errno != EEXIST) {
+ giterr_set(GITERR_OS, "Failed to create directory at '%s'", path);
+ return -1;
+ }
+
+ return 0;
+}
+
int git_futils_mkdir_r(const char *path, const char *base, const mode_t mode)
{
git_buf make_path = GIT_BUF_INIT;