Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Morgan <brad@dmgctrl.com>2013-05-15 00:03:09 +0400
committerBrad Morgan <brad@dmgctrl.com>2013-05-15 00:03:09 +0400
commitfbcab44b208ae726450289794ecf8e69af3f7e58 (patch)
treeab008e1a89db9feac5171c088a7ffa65bb0228ca /src/checkout.c
parent000e68961cb44b04435a733e151f8b1357547bd1 (diff)
Create directory for symlink before creating symlink
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/checkout.c b/src/checkout.c
index e9ec2bdab..6835db073 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -764,11 +764,14 @@ cleanup:
}
static int blob_content_to_link(
- struct stat *st, git_blob *blob, const char *path, int can_symlink)
+ struct stat *st, git_blob *blob, const char *path, mode_t dir_mode, int can_symlink)
{
git_buf linktarget = GIT_BUF_INIT;
int error;
+ if ((error = git_futils_mkpath2file(path, dir_mode)) < 0)
+ return error;
+
if ((error = git_blob__getbuf(&linktarget, blob)) < 0)
return error;
@@ -914,7 +917,7 @@ static int checkout_blob(
if (S_ISLNK(file->mode))
error = blob_content_to_link(
- &st, blob, git_buf_cstr(&data->path), data->can_symlink);
+ &st, blob, git_buf_cstr(&data->path), data->opts.dir_mode, data->can_symlink);
else
error = blob_content_to_file(
&st, blob, git_buf_cstr(&data->path), file->mode, &data->opts);