From: Junio C Hamano Date: Thu, 2 Feb 2017 21:36:57 +0000 (-0800) Subject: Merge branch 'js/mingw-hooks-with-exe-suffix' X-Git-Tag: v2.12.0-rc0~14 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7?hp=-c Merge branch 'js/mingw-hooks-with-exe-suffix' Names of the various hook scripts must be spelled exactly, but on Windows, an .exe binary must be named with .exe suffix; notice $GIT_DIR/hooks/.exe as a valid hook. * js/mingw-hooks-with-exe-suffix: mingw: allow hooks to be .exe files --- cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7 diff --combined run-command.c index 73bfba7ef9,79780a4ab2..5227f78aea --- a/run-command.c +++ b/run-command.c @@@ -29,8 -29,6 +29,8 @@@ static int installed_child_cleanup_hand static void cleanup_children(int sig, int in_signal) { + struct child_to_clean *children_to_wait_for = NULL; + while (children_to_clean) { struct child_to_clean *p = children_to_clean; children_to_clean = p->next; @@@ -47,23 -45,6 +47,23 @@@ } kill(p->pid, sig); + + if (p->process->wait_after_clean) { + p->next = children_to_wait_for; + children_to_wait_for = p; + } else { + if (!in_signal) + free(p); + } + } + + while (children_to_wait_for) { + struct child_to_clean *p = children_to_wait_for; + children_to_wait_for = p->next; + + while (waitpid(p->pid, NULL, 0) < 0 && errno == EINTR) + ; /* spin waiting for process exit or error */ + if (!in_signal) free(p); } @@@ -871,8 -852,14 +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; }