mirror of
https://git.proxmox.com/git/libgit2
synced 2025-07-10 13:25:14 +00:00
Merge pull request #1582 from dmgctrl/checkout_symlink_fix
Create directory for symlink before creating symlink
This commit is contained in:
commit
33539b109c
@ -764,11 +764,14 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int blob_content_to_link(
|
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;
|
git_buf linktarget = GIT_BUF_INIT;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
if ((error = git_futils_mkpath2file(path, dir_mode)) < 0)
|
||||||
|
return error;
|
||||||
|
|
||||||
if ((error = git_blob__getbuf(&linktarget, blob)) < 0)
|
if ((error = git_blob__getbuf(&linktarget, blob)) < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
@ -914,7 +917,7 @@ static int checkout_blob(
|
|||||||
|
|
||||||
if (S_ISLNK(file->mode))
|
if (S_ISLNK(file->mode))
|
||||||
error = blob_content_to_link(
|
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
|
else
|
||||||
error = blob_content_to_file(
|
error = blob_content_to_file(
|
||||||
&st, blob, git_buf_cstr(&data->path), file->mode, &data->opts);
|
&st, blob, git_buf_cstr(&data->path), file->mode, &data->opts);
|
||||||
|
Loading…
Reference in New Issue
Block a user