read-tree -m: make error message for merging 0 trees less smart aleck
[gitweb.git] / help.c
diff --git a/help.c b/help.c
index 53e2a67e0052b7abb9f01e075f76c4eb5f35cbfc..a07f01e6f9fc7895f27f3ee9a4a7e291ce995b0f 100644 (file)
--- a/help.c
+++ b/help.c
@@ -105,7 +105,22 @@ static int is_executable(const char *name)
                return 0;
 
 #if defined(GIT_WINDOWS_NATIVE)
-{      /* cannot trust the executable bit, peek into the file instead */
+       /*
+        * On Windows there is no executable bit. The file extension
+        * indicates whether it can be run as an executable, and Git
+        * has special-handling to detect scripts and launch them
+        * through the indicated script interpreter. We test for the
+        * file extension first because virus scanners may make
+        * it quite expensive to open many files.
+        */
+       if (ends_with(name, ".exe"))
+               return S_IXUSR;
+
+{
+       /*
+        * Now that we know it does not have an executable extension,
+        * peek into the file instead.
+        */
        char buf[3] = { 0 };
        int n;
        int fd = open(name, O_RDONLY);
@@ -113,8 +128,8 @@ static int is_executable(const char *name)
        if (fd >= 0) {
                n = read(fd, buf, 2);
                if (n == 2)
-                       /* DOS executables start with "MZ" */
-                       if (!strcmp(buf, "#!") || !strcmp(buf, "MZ"))
+                       /* look for a she-bang */
+                       if (!strcmp(buf, "#!"))
                                st.st_mode |= S_IXUSR;
                close(fd);
        }
@@ -396,8 +411,8 @@ const char *help_unknown_cmd(const char *cmd)
 
        if (SIMILAR_ENOUGH(best_similarity)) {
                fprintf_ln(stderr,
-                          Q_("\nDid you mean this?",
-                             "\nDid you mean one of these?",
+                          Q_("\nThe most similar command is",
+                             "\nThe most similar commands are",
                           n));
 
                for (i = 0; i < n; i++)