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

[PATCH v3] mingw: allow hooks to be .exe files

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 30, 2017, 12:28 UTC
Message-ID
<78a73c9d0a8e38fcc61302d0495533dcc4fab076.1485779272.git.johannes.schindelin@gmx.de>
In-Reply-To
<9a27b90e771d4c97dc580d344e161d7cf8d632ce.1485433248.git.johannes.schindelin@gmx.de>

Executable files in Windows need to have the extension '.exe', otherwise they do not work. Extend the hooks to not just look at the hard coded names, but also at the names extended by the custom STRIP_EXTENSION, which is defined as '.exe' in Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Published-As: https://github.com/dscho/git/releases/tag/exe-as-hook-v3
Fetch-It-Via: git fetch https://github.com/dscho/git exe-as-hook-v3
 run-command.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/run-command.c b/run-command.c
index 73bfba7ef9..5227f78aea 100644
--- a/run-command.c
+++ b/run-command.c
@@ -871,8 +871,14 @@ const char *find_hook(const char *name)
 
 	strbuf_reset(&path);
 	strbuf_git_path(&path, "hooks/%s", name);
-	if (access(path.buf, X_OK) < 0)
+	if (access(path.buf, X_OK) < 0) {
+#ifdef STRIP_EXTENSION
+		strbuf_addstr(&path, STRIP_EXTENSION);
+		if (access(path.buf, X_OK) >= 0)
+			return path.buf;
+#endif
 		return NULL;
+	}
 	return path.buf;
 }
 

base-commit: 4e59582ff70d299f5a88449891e78d15b4b3fabe
-- 
2.11.1.windows.prerelease.2.9.g3014b57
Previous: Johannes SchindelinNext: Junio C Hamano
Message 12 of 13 in “mingw: allow hooks to be .exe files”
  1. mingw: allow hooks to be .exe filesJohannes Schindelin, Jan 25, 2017
  2. Jeff KingJan 25, 2017
  3. Junio C HamanoJan 25, 2017
  4. Johannes SchindelinJan 26, 2017
  5. Junio C HamanoJan 26, 2017
  6. Johannes SchindelinJan 27, 2017
  7. Stefan BellerJan 27, 2017
  8. Johannes SchindelinJan 30, 2017
  9. Junio C HamanoJan 25, 2017
  10. Johannes SchindelinJan 26, 2017
  11. mingw: allow hooks to be .exe filesJohannes Schindelin, Jan 26, 2017
  12. mingw: allow hooks to be .exe filesJohannes Schindelin, Jan 30, 2017
  13. 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.