Thread (2 messages) flat view 2 messages, 2 authors, 2022-09-02

Re: [PATCH] t1800: correct test to handle Cygwin

From: Junio C Hamano <hidden>
Date: 2022-09-01 18:32:17

Adam Dinwoodie [off-list ref] writes:
On Cygwin, when failing to spawn a process using start_command, Git
outputs the same error as on Linux systems, rather than using the
GIT_WINDOWS_NATIVE-specific error output.  The WINDOWS test prerequisite
is set in both Cygwin and native Windows environments, which means it's
not appropriate to use to anticipate the error output from
start_command.  Instead, use the MINGW test prerequisite, which is only
set for Git in native Windows environments, and not for Cygwin.

Signed-off-by: Adam Dinwoodie <redacted>
---

The job of setting Cygwin up to get Git CI builds, either as part of the
main CI builds or as something using separate automation, is rapidly
rising up my when-I-have-the-time to-do list...
I added a few who probably are more familiar with Windows situation
than those already CC'ed.

A quick grep in the test directory

    $ git grep '\<WINDOWS\>" t

hits this one and t7450-bad-git-dotfiles.sh and nothing else, but
we do have quite a many hits of "test_have_prereq !MINGW,!CYGWIN".

I guess it depends on how common various "glitches" MINGW and CYGWIN
prerequistes are trying to cover, but I am wondering if we are
helped by having three (i.e. MINGW, CYGWIN, and WINDOWS)
prerequisites, or does WINDOWS as a separate prerequisite
contributes more to the confusion (and if so, if it is a good idea
to remove and use only MINGW and CYGWIN prerequistes).

One possible roadblock is that it is not easy to express "MINGW or
CYGWIN" in the prerequisite syntax and WINDOWS prerequisite is an
easy way to fill that gap.

In any case, thanks for a fix.  Will queue.
quoted hunk
 t/t1800-hook.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh
index 64096adac7..fae8b2faf9 100755
--- a/t/t1800-hook.sh
+++ b/t/t1800-hook.sh
@@ -159,7 +159,7 @@ test_expect_success 'git hook run a hook with a bad shebang' '
 	# TODO: We should emit the same (or at least a more similar)
 	# error on Windows and !Windows. See the OS-specific code in
 	# start_command()
-	if test_have_prereq !WINDOWS
+	if test_have_prereq !MINGW
 	then
 		cat >expect <<-\EOF
 		fatal: cannot run bad-hooks/test-hook: ...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help