Commit 128c5ca930fb30fff36e1eb5ff95c61ecd074edf

Edward Thomson 2017-10-07T12:23:33

checkout: do not test file mode on Windows On Windows, we do not support file mode changes, so do not test for type changes between the disk and tree being checked out. We could have false positives since the on-disk file can only have an (effective) mode of 0100644 since NTFS does not support executable files. If the tree being checked out did have an executable file, we would erroneously decide that the file on disk had been changed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/checkout.c b/src/checkout.c
index 61c85ce..caed6cd 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -161,7 +161,15 @@ GIT_INLINE(bool) is_workdir_base_or_new(
 
 GIT_INLINE(bool) is_file_mode_changed(git_filemode_t a, git_filemode_t b)
 {
+#ifdef GIT_WIN32
+	/*
+	 * On Win32 we do not support the executable bit; the file will
+	 * always be 0100644 on disk, don't bother doing a test.
+	 */
+	return false;
+#else
 	return (S_ISREG(a) && S_ISREG(b) && a != b);
+#endif
 }
 
 static bool checkout_is_workdir_modified(