From 33127043b3ef8dd8dd695ba3613eaa104a80a56b Mon Sep 17 00:00:00 2001 From: Brodie Rao Date: Fri, 14 Oct 2011 14:18:02 -0700 Subject: fileops/posix: replace usage of "int mode" with "mode_t mode" Note: Functions exported from fileops take const mode_t, while the underlying POSIX wrappers take mode_t. --- src/fileops.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/fileops.h') diff --git a/src/fileops.h b/src/fileops.h index 5b69199d2..176888895 100644 --- a/src/fileops.h +++ b/src/fileops.h @@ -48,18 +48,18 @@ extern int git_futils_exists(const char *path); * Create and open a file, while also * creating all the folders in its path */ -extern int git_futils_creat_withpath(const char *path, int mode); +extern int git_futils_creat_withpath(const char *path, const mode_t mode); /** * Create an open a process-locked file */ -extern int git_futils_creat_locked(const char *path, int mode); +extern int git_futils_creat_locked(const char *path, const mode_t mode); /** * Create an open a process-locked file, while * also creating all the folders in its path */ -extern int git_futils_creat_locked_withpath(const char *path, int mode); +extern int git_futils_creat_locked_withpath(const char *path, const mode_t mode); /** * Check if the given path points to a directory @@ -74,7 +74,7 @@ extern int git_futils_isfile(const char *path); /** * Create a path recursively */ -extern int git_futils_mkdir_r(const char *path, int mode); +extern int git_futils_mkdir_r(const char *path, const mode_t mode); /** * Create all the folders required to contain -- cgit v1.2.1 From ce8cd006ce3adcd012a38401b8a7555ba3307b3f Mon Sep 17 00:00:00 2001 From: Brodie Rao Date: Wed, 7 Sep 2011 15:32:44 -0700 Subject: fileops/repository: create (most) directories with 0777 permissions To further match how Git behaves, this change makes most of the directories libgit2 creates in a git repo have a file mode of 0777. Specifically: - Intermediate directories created with git_futils_mkpath2file() have 0777 permissions. This affects odb_loose, reflog, and refs. - The top level folder for bare repos is created with 0777 permissions. - The top level folder for non-bare repos is created with 0755 permissions. - /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are created with 0777 permissions. Additionally, the following changes have been made: - fileops functions that create intermediate directories have grown a new dirmode parameter. The only exception to this is filebuf's lock_file(), which unconditionally creates intermediate directories with 0777 permissions when GIT_FILEBUF_FORCE is set. - The test runner now sets the umask to 0 before running any tests. This ensurses all file mode checks are consistent across systems. - t09-tree.c now does a directory permissions check. I've avoided adding this check to other tests that might reuse existing directories from the prefabricated test repos. Because they're checked into the repo, they have 0755 permissions. - Other assorted directories created by tests have 0777 permissions. --- src/fileops.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/fileops.h') diff --git a/src/fileops.h b/src/fileops.h index 176888895..56c4770cb 100644 --- a/src/fileops.h +++ b/src/fileops.h @@ -48,7 +48,7 @@ extern int git_futils_exists(const char *path); * Create and open a file, while also * creating all the folders in its path */ -extern int git_futils_creat_withpath(const char *path, const mode_t mode); +extern int git_futils_creat_withpath(const char *path, const mode_t dirmode, const mode_t mode); /** * Create an open a process-locked file @@ -59,7 +59,7 @@ extern int git_futils_creat_locked(const char *path, const mode_t mode); * Create an open a process-locked file, while * also creating all the folders in its path */ -extern int git_futils_creat_locked_withpath(const char *path, const mode_t mode); +extern int git_futils_creat_locked_withpath(const char *path, const mode_t dirmode, const mode_t mode); /** * Check if the given path points to a directory @@ -80,7 +80,7 @@ extern int git_futils_mkdir_r(const char *path, const mode_t mode); * Create all the folders required to contain * the full path of a file */ -extern int git_futils_mkpath2file(const char *path); +extern int git_futils_mkpath2file(const char *path, const mode_t mode); extern int git_futils_rmdir_r(const char *path, int force); @@ -98,7 +98,7 @@ extern int git_futils_mv_atomic(const char *from, const char *to); * Move a file on the filesystem, create the * destination path if it doesn't exist */ -extern int git_futils_mv_withpath(const char *from, const char *to); +extern int git_futils_mv_withpath(const char *from, const char *to, const mode_t dirmode); /** -- cgit v1.2.1