Skip to content

Commit 128c5ca

Browse files
committed
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 parent 752b7c7 commit 128c5ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/checkout.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,15 @@ GIT_INLINE(bool) is_workdir_base_or_new(
161161

162162
GIT_INLINE(bool) is_file_mode_changed(git_filemode_t a, git_filemode_t b)
163163
{
164+
#ifdef GIT_WIN32
165+
/*
166+
* On Win32 we do not support the executable bit; the file will
167+
* always be 0100644 on disk, don't bother doing a test.
168+
*/
169+
return false;
170+
#else
164171
return (S_ISREG(a) && S_ISREG(b) && a != b);
172+
#endif
165173
}
166174

167175
static bool checkout_is_workdir_modified(

0 commit comments

Comments
 (0)