diff options
| author | Vicent Martà <tanoku@gmail.com> | 2011-10-28 19:04:23 -0700 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2011-10-28 19:04:23 -0700 |
| commit | 89fb8f025a1f72b90f1f9563c85bf43b7f66ba60 (patch) | |
| tree | 11726793eecf4670d4948a22e276dd3d50d1addb /src/repository.c | |
| parent | 3286c408eccb18c525ca123383f3ebf5097441bc (diff) | |
| parent | 01ad7b3a9ec8f5e465f94c2704e1e96b84f941c7 (diff) | |
| download | libgit2-89fb8f025a1f72b90f1f9563c85bf43b7f66ba60.tar.gz | |
Merge pull request #456 from brodie/perm-fixes
Create objects, indexes, and directories with the right file permissions
Diffstat (limited to 'src/repository.c')
| -rw-r--r-- | src/repository.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/repository.c b/src/repository.c index 33a3f270b..849e1a9cf 100644 --- a/src/repository.c +++ b/src/repository.c @@ -609,12 +609,11 @@ static int repo_init_createhead(git_repository *repo) static int repo_init_structure(const char *git_dir, int is_bare) { - const int mode = 0755; /* or 0777 ? */ int error; char temp_path[GIT_PATH_MAX]; - if (git_futils_mkdir_r(git_dir, mode)) + if (git_futils_mkdir_r(git_dir, is_bare ? GIT_BARE_DIR_MODE : GIT_DIR_MODE)) return git__throw(GIT_ERROR, "Failed to initialize repository structure. Could not mkdir"); /* Hides the ".git" directory */ @@ -628,25 +627,25 @@ static int repo_init_structure(const char *git_dir, int is_bare) /* Creates the '/objects/info/' directory */ git_path_join(temp_path, git_dir, GIT_OBJECTS_INFO_DIR); - error = git_futils_mkdir_r(temp_path, mode); + error = git_futils_mkdir_r(temp_path, GIT_OBJECT_DIR_MODE); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to initialize repository structure"); /* Creates the '/objects/pack/' directory */ git_path_join(temp_path, git_dir, GIT_OBJECTS_PACK_DIR); - error = p_mkdir(temp_path, mode); + error = p_mkdir(temp_path, GIT_OBJECT_DIR_MODE); if (error < GIT_SUCCESS) return git__throw(error, "Unable to create `%s` folder", temp_path); /* Creates the '/refs/heads/' directory */ git_path_join(temp_path, git_dir, GIT_REFS_HEADS_DIR); - error = git_futils_mkdir_r(temp_path, mode); + error = git_futils_mkdir_r(temp_path, GIT_REFS_DIR_MODE); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to initialize repository structure"); /* Creates the '/refs/tags/' directory */ git_path_join(temp_path, git_dir, GIT_REFS_TAGS_DIR); - error = p_mkdir(temp_path, mode); + error = p_mkdir(temp_path, GIT_REFS_DIR_MODE); if (error < GIT_SUCCESS) return git__throw(error, "Unable to create `%s` folder", temp_path); |
