git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] help: improve is_executable() on Windows

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 30, 2017, 17:03 UTC
Message-ID
<xmqqmve8wkds.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<4b93fe44ff9020ed80e4fd93a24a6ffa647e7678.1485780050.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 17 quoted lines
> From: Heiko Voigt <hvoigt@hvoigt.net>
>
> On Windows, executables need to have the file extension `.exe`, or they
> are not executables. Hence, to support scripts, Git for Windows also
> looks for a she-bang line by opening the file in question, and executing
> it via the specified script interpreter.
>
> To figure out whether files in the `PATH` are executable, `git help` has
> code that imitates this behavior. With one exception: it *always* opens
> the files and looks for a she-bang line *or* an `MZ` tell-tale
> (nevermind that files with the magic `MZ` but without file extension
> `.exe` would still not be executable).
>
> Opening this many files leads to performance problems that are even more
> serious when a virus scanner is running. Therefore, let's change the
> code to look for the file extension `.exe` early, and avoid opening the
> file altogether if we already know that it is executable.
Much more readable than the initial round.  Will queue; thanks.
Previous: Johannes Schindelin
Message 5 of 5 in “help: correct behavior for is_executable on Windows”
  1. help: correct behavior for is_executable on WindowsJohannes Schindelin, Jan 27, 2017
  2. Junio C HamanoJan 27, 2017
  3. Johannes SchindelinJan 30, 2017
  4. help: improve is_executable() on WindowsJohannes Schindelin, Jan 30, 2017
  5. Junio C HamanoJan 30, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.