Commit a7fcc44dcf3b2925ba366543486afd102b41838c

Russell Belfer 2013-09-05T16:14:32

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

diff --git a/src/checkout.c b/src/checkout.c
index f3a9b34..aae354c 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 96937d8..ee4b5fc 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 f214456..02f79b9 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 91309e1..f946919 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 e6ce463..00388ee 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 43bd7af..e3fc112 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");