Address style concerns in setting mkdir/copy flags.

This commit is contained in:
Edward Lee 2014-05-23 22:41:35 -04:00
parent bafaf790cd
commit 517341c5d8

View File

@ -1232,15 +1232,10 @@ static int repo_init_structure(
} }
if (tdir) { if (tdir) {
if (chmod) { uint32_t cpflags = GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_SIMPLE_TO_MODE;
error = git_futils_cp_r(tdir, repo_dir, if (opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK)
GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS | cpflags |= GIT_CPDIR_CHMOD_DIRS;
GIT_CPDIR_SIMPLE_TO_MODE, dmode); error = git_futils_cp_r(tdir, repo_dir, cpflags, 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);
@ -1263,13 +1258,12 @@ static int repo_init_structure(
*/ */
for (tpl = repo_template; !error && tpl->path; ++tpl) { for (tpl = repo_template; !error && tpl->path; ++tpl) {
if (!tpl->content) { if (!tpl->content) {
if (chmod) { uint32_t mkdir_flags = GIT_MKDIR_PATH;
error = git_futils_mkdir( if (chmod)
tpl->path, repo_dir, dmode, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD); mkdir_flags |= GIT_MKDIR_CHMOD;
} else {
error = git_futils_mkdir( error = git_futils_mkdir(
tpl->path, repo_dir, dmode, GIT_MKDIR_PATH); tpl->path, repo_dir, dmode, mkdir_flags);
}
} }
else if (!external_tpl) { else if (!external_tpl) {
const char *content = tpl->content; const char *content = tpl->content;