mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-10 06:56:25 +00:00
Fixed permissions on template directories.
This commit is contained in:
parent
228272ef58
commit
bafaf790cd
@ -1190,6 +1190,7 @@ static int repo_init_structure(
|
|||||||
bool external_tpl =
|
bool external_tpl =
|
||||||
((opts->flags & GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE) != 0);
|
((opts->flags & GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE) != 0);
|
||||||
mode_t dmode = pick_dir_mode(opts);
|
mode_t dmode = pick_dir_mode(opts);
|
||||||
|
bool chmod = opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK;
|
||||||
|
|
||||||
/* Hide the ".git" directory */
|
/* Hide the ".git" directory */
|
||||||
#ifdef GIT_WIN32
|
#ifdef GIT_WIN32
|
||||||
@ -1230,10 +1231,17 @@ static int repo_init_structure(
|
|||||||
default_template = true;
|
default_template = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdir)
|
if (tdir) {
|
||||||
|
if (chmod) {
|
||||||
error = git_futils_cp_r(tdir, repo_dir,
|
error = git_futils_cp_r(tdir, repo_dir,
|
||||||
GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS |
|
GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS |
|
||||||
GIT_CPDIR_SIMPLE_TO_MODE, dmode);
|
GIT_CPDIR_SIMPLE_TO_MODE, dmode);
|
||||||
|
} else {
|
||||||
|
error = git_futils_cp_r(tdir, repo_dir,
|
||||||
|
GIT_CPDIR_COPY_SYMLINKS |
|
||||||
|
GIT_CPDIR_SIMPLE_TO_MODE, dmode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
git_buf_free(&template_buf);
|
git_buf_free(&template_buf);
|
||||||
git_config_free(cfg);
|
git_config_free(cfg);
|
||||||
@ -1254,9 +1262,15 @@ static int repo_init_structure(
|
|||||||
* - only create files if no external template was specified
|
* - only create files if no external template was specified
|
||||||
*/
|
*/
|
||||||
for (tpl = repo_template; !error && tpl->path; ++tpl) {
|
for (tpl = repo_template; !error && tpl->path; ++tpl) {
|
||||||
if (!tpl->content)
|
if (!tpl->content) {
|
||||||
|
if (chmod) {
|
||||||
error = git_futils_mkdir(
|
error = git_futils_mkdir(
|
||||||
tpl->path, repo_dir, dmode, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD);
|
tpl->path, repo_dir, dmode, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD);
|
||||||
|
} else {
|
||||||
|
error = git_futils_mkdir(
|
||||||
|
tpl->path, repo_dir, dmode, GIT_MKDIR_PATH);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!external_tpl) {
|
else if (!external_tpl) {
|
||||||
const char *content = tpl->content;
|
const char *content = tpl->content;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user