Commit a7fcc44d by Russell Belfer

Better macro name for is-exec-bit-set test

parent af22dabb
...@@ -696,7 +696,7 @@ static int buffer_to_file( ...@@ -696,7 +696,7 @@ static int buffer_to_file(
if (st != NULL && (error = p_stat(path, st)) < 0) if (st != NULL && (error = p_stat(path, st)) < 0)
giterr_set(GITERR_OS, "Error statting '%s'", path); giterr_set(GITERR_OS, "Error statting '%s'", path);
else if (GIT_PERMS_EXECUTABLE(file_mode) && else if (GIT_PERMS_IS_EXEC(file_mode) &&
(error = p_chmod(path, file_mode)) < 0) (error = p_chmod(path, file_mode)) < 0)
giterr_set(GITERR_OS, "Failed to set permissions on '%s'", path); giterr_set(GITERR_OS, "Failed to set permissions on '%s'", path);
......
...@@ -46,7 +46,7 @@ static char diff_pick_suffix(int mode) ...@@ -46,7 +46,7 @@ static char diff_pick_suffix(int mode)
{ {
if (S_ISDIR(mode)) if (S_ISDIR(mode))
return '/'; return '/';
else if (GIT_PERMS_EXECUTABLE(mode)) /* -V536 */ else if (GIT_PERMS_IS_EXEC(mode)) /* -V536 */
/* in git, modes are very regular, so we must have 0100755 mode */ /* in git, modes are very regular, so we must have 0100755 mode */
return '*'; return '*';
else else
......
...@@ -223,9 +223,9 @@ extern int git_futils_open_ro(const char *path); ...@@ -223,9 +223,9 @@ extern int git_futils_open_ro(const char *path);
*/ */
extern git_off_t git_futils_filesize(git_file fd); extern git_off_t git_futils_filesize(git_file fd);
#define GIT_PERMS_EXECUTABLE(MODE) (((MODE) & 0111) != 0) #define GIT_PERMS_IS_EXEC(MODE) (((MODE) & 0111) != 0)
#define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_EXECUTABLE(MODE) ? 0755 : 0644) #define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0755 : 0644)
#define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_EXECUTABLE(MODE) ? 0777 : 0666) #define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0777 : 0666)
#define GIT_MODE_PERMS_MASK 0777 #define GIT_MODE_PERMS_MASK 0777
#define GIT_MODE_TYPE_MASK 0170000 #define GIT_MODE_TYPE_MASK 0170000
......
...@@ -33,7 +33,7 @@ GIT_INLINE(git_filemode_t) normalize_filemode(git_filemode_t filemode) ...@@ -33,7 +33,7 @@ GIT_INLINE(git_filemode_t) normalize_filemode(git_filemode_t filemode)
return GIT_FILEMODE_TREE; return GIT_FILEMODE_TREE;
/* If any of the x bits are set */ /* If any of the x bits are set */
if (GIT_PERMS_EXECUTABLE(filemode)) if (GIT_PERMS_IS_EXEC(filemode))
return GIT_FILEMODE_BLOB_EXECUTABLE; return GIT_FILEMODE_BLOB_EXECUTABLE;
/* 16XXXX means commit */ /* 16XXXX means commit */
......
...@@ -112,7 +112,7 @@ static void check_stat_data(git_index *index, const char *path, bool match) ...@@ -112,7 +112,7 @@ static void check_stat_data(git_index *index, const char *path, bool match)
cl_assert_equal_i_fmt( cl_assert_equal_i_fmt(
GIT_MODE_TYPE(st.st_mode), GIT_MODE_TYPE(entry->mode), "%07o"); GIT_MODE_TYPE(st.st_mode), GIT_MODE_TYPE(entry->mode), "%07o");
cl_assert_equal_b( cl_assert_equal_b(
GIT_PERMS_EXECUTABLE(st.st_mode), GIT_PERMS_EXECUTABLE(entry->mode)); GIT_PERMS_IS_EXEC(st.st_mode), GIT_PERMS_IS_EXEC(entry->mode));
} else { } else {
/* most things will still match */ /* most things will still match */
cl_assert(st.st_size != entry->file_size); cl_assert(st.st_size != entry->file_size);
......
...@@ -422,7 +422,7 @@ static void assert_mode_seems_okay( ...@@ -422,7 +422,7 @@ static void assert_mode_seems_okay(
cl_assert_equal_b(expect_setgid, (st.st_mode & S_ISGID) != 0); cl_assert_equal_b(expect_setgid, (st.st_mode & S_ISGID) != 0);
cl_assert_equal_b( cl_assert_equal_b(
GIT_PERMS_EXECUTABLE(expect_mode), GIT_PERMS_EXECUTABLE(st.st_mode)); GIT_PERMS_IS_EXEC(expect_mode), GIT_PERMS_IS_EXEC(st.st_mode));
cl_assert_equal_i_fmt( cl_assert_equal_i_fmt(
GIT_MODE_TYPE(expect_mode), GIT_MODE_TYPE(st.st_mode), "%07o"); GIT_MODE_TYPE(expect_mode), GIT_MODE_TYPE(st.st_mode), "%07o");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment