From a7fcc44dcf3b2925ba366543486afd102b41838c Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Thu, 5 Sep 2013 16:14:32 -0700 Subject: [PATCH] Better macro name for is-exec-bit-set test --- src/checkout.c | 2 +- src/diff_print.c | 2 +- src/fileops.h | 6 +++--- src/tree.c | 2 +- tests-clar/index/addall.c | 2 +- tests-clar/repo/init.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/checkout.c b/src/checkout.c index f3a9b343d..aae354ca6 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -696,7 +696,7 @@ static int buffer_to_file( if (st != NULL && (error = p_stat(path, st)) < 0) 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) giterr_set(GITERR_OS, "Failed to set permissions on '%s'", path); diff --git a/src/diff_print.c b/src/diff_print.c index 96937d84d..ee4b5fc17 100644 --- a/src/diff_print.c +++ b/src/diff_print.c @@ -46,7 +46,7 @@ static char diff_pick_suffix(int mode) { if (S_ISDIR(mode)) 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 */ return '*'; else diff --git a/src/fileops.h b/src/fileops.h index f2144566d..02f79b9e7 100644 --- a/src/fileops.h +++ b/src/fileops.h @@ -223,9 +223,9 @@ 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_PERMS_IS_EXEC(MODE) (((MODE) & 0111) != 0) +#define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0755 : 0644) +#define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0777 : 0666) #define GIT_MODE_PERMS_MASK 0777 #define GIT_MODE_TYPE_MASK 0170000 diff --git a/src/tree.c b/src/tree.c index 91309e107..f9469195a 100644 --- a/src/tree.c +++ b/src/tree.c @@ -33,7 +33,7 @@ GIT_INLINE(git_filemode_t) normalize_filemode(git_filemode_t filemode) return GIT_FILEMODE_TREE; /* If any of the x bits are set */ - if (GIT_PERMS_EXECUTABLE(filemode)) + if (GIT_PERMS_IS_EXEC(filemode)) return GIT_FILEMODE_BLOB_EXECUTABLE; /* 16XXXX means commit */ diff --git a/tests-clar/index/addall.c b/tests-clar/index/addall.c index e6ce463a3..00388ee00 100644 --- a/tests-clar/index/addall.c +++ b/tests-clar/index/addall.c @@ -112,7 +112,7 @@ static void check_stat_data(git_index *index, const char *path, bool match) cl_assert_equal_i_fmt( GIT_MODE_TYPE(st.st_mode), GIT_MODE_TYPE(entry->mode), "%07o"); 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 { /* most things will still match */ cl_assert(st.st_size != entry->file_size); diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c index 43bd7afe0..e3fc112b3 100644 --- a/tests-clar/repo/init.c +++ b/tests-clar/repo/init.c @@ -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( - 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( GIT_MODE_TYPE(expect_mode), GIT_MODE_TYPE(st.st_mode), "%07o");