Skip to content

Commit 86b4714

Browse files
committed
fixup! help: correct behavior for is_executable on Windows
1 parent dba9971 commit 86b4714

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

help.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,22 @@ static int is_executable(const char *name)
105105
return 0;
106106

107107
#if defined(GIT_WINDOWS_NATIVE)
108-
/* On Windows we cannot use the executable bit. The executable
109-
* state is determined by extension only. We do this first
110-
* because with virus scanners opening an executeable for
111-
* reading is potentially expensive.
108+
/*
109+
* On Windows there is no executable bit. The file extension
110+
* indicates whether it can be run as an executable, and Git
111+
* has special-handling to detect scripts and launch them
112+
* through the indicated script interpreter. We test for the
113+
* file extension first because virus scanners may make
114+
* opening an executable for reading expensive.
112115
*/
113116
if (ends_with(name, ".exe"))
114117
return S_IXUSR;
115118

116-
{ /* now that we know it does not have an executable extension,
117-
peek into the file instead */
119+
{
120+
/*
121+
* Now that we know it does not have an executable extension,
122+
* peek into the file instead.
123+
*/
118124
char buf[3] = { 0 };
119125
int n;
120126
int fd = open(name, O_RDONLY);

0 commit comments

Comments
 (0)