diff options
author | Edward Lee <e45lee@uwaterloo.ca> | 2014-05-23 22:41:35 -0400 |
---|---|---|
committer | Edward Lee <e45lee@uwaterloo.ca> | 2014-05-23 22:41:35 -0400 |
commit | 517341c5d8b316f5590d55a4913a65c78ab05973 (patch) | |
tree | 46dc768a2b5548e6c5db2c8fcae9864ee4b7d8b3 | |
parent | bafaf790cd26e6dd827599f2d07d76e82f346e1a (diff) | |
download | libgit2-517341c5d8b316f5590d55a4913a65c78ab05973.tar.gz |
Address style concerns in setting mkdir/copy flags.
-rw-r--r-- | src/repository.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/repository.c b/src/repository.c index 695351977..e8d50aed3 100644 --- a/src/repository.c +++ b/src/repository.c @@ -1232,15 +1232,10 @@ static int repo_init_structure( } if (tdir) { - if (chmod) { - error = git_futils_cp_r(tdir, repo_dir, - GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS | - 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); - } + uint32_t cpflags = GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_SIMPLE_TO_MODE; + if (opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK) + cpflags |= GIT_CPDIR_CHMOD_DIRS; + error = git_futils_cp_r(tdir, repo_dir, cpflags, dmode); } git_buf_free(&template_buf); @@ -1263,13 +1258,12 @@ static int repo_init_structure( */ for (tpl = repo_template; !error && tpl->path; ++tpl) { if (!tpl->content) { - if (chmod) { - error = git_futils_mkdir( - tpl->path, repo_dir, dmode, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD); - } else { - error = git_futils_mkdir( - tpl->path, repo_dir, dmode, GIT_MKDIR_PATH); - } + uint32_t mkdir_flags = GIT_MKDIR_PATH; + if (chmod) + mkdir_flags |= GIT_MKDIR_CHMOD; + + error = git_futils_mkdir( + tpl->path, repo_dir, dmode, mkdir_flags); } else if (!external_tpl) { const char *content = tpl->content; |