diff options
author | Russell Belfer <rb@github.com> | 2013-09-05 11:20:12 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-09-05 11:20:12 -0700 |
commit | f240acce865ec14df0d517d5000316a933e7ffed (patch) | |
tree | 33bb2efbb07ac32178ce242899ecaa8c6842c308 /src/fileops.h | |
parent | 27061b151a7e0225186365ee0b5ca802d68782a9 (diff) | |
download | libgit2-f240acce865ec14df0d517d5000316a933e7ffed.tar.gz |
Add more file mode permissions macros
This adds some more macros for some standard operations on file
modes, particularly related to permissions, and then updates a
number of places around the code base to use the new macros.
Diffstat (limited to 'src/fileops.h')
-rw-r--r-- | src/fileops.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fileops.h b/src/fileops.h index 5adedfc57..142eb99d2 100644 --- a/src/fileops.h +++ b/src/fileops.h @@ -223,8 +223,11 @@ extern int git_futils_open_ro(const char *path); */ extern git_off_t git_futils_filesize(git_file fd); +#define GIT_PERMS_EXECUTABLE(MODE) (((MODE) & 0111) != 0) +#define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_EXECUTABLE(MODE) ? 0755 : 0644) +#define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_EXECUTABLE(MODE) ? 0777 : 0666) + #define GIT_MODE_PERMS_MASK 0777 -#define GIT_CANONICAL_PERMS(MODE) (((MODE) & 0100) ? 0755 : 0644) #define GIT_MODE_TYPE(MODE) ((MODE) & ~GIT_MODE_PERMS_MASK) #define GIT_MODE_ISBLOB(MODE) (GIT_MODE_TYPE(MODE) == GIT_MODE_TYPE(GIT_FILEMODE_BLOB)) |