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

Re: [PATCH] t5801: properly test the test shell

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 25, 2013, 17:12 UTC
Message-ID
<7vfvye4jrc.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vppxi60pj.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 25 quoted lines
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> fc407f9 (Add new simplified git-remote-testgit, 2012-11-28) introduced a
>> test which was meant to skip the test unless the test shell is bash.
>> Unfortunately, it tests for the availability of bash only.
>
> True.
>
>> But users can
>> opt to use a different shell (using SHELL_PATH) for the tests even though
>> bash is available.
>>
>> At least for dash,
>> 21610d8 (transport-helper: clarify pushing without refspecs, 2013-04-17)
>> is the commit which actually introduces a test (pushing without refspec)
>> which fails to fail even though it is supposed to. It uses the
>> construct:
>>
>> VAR=value function arguments
>
> The right fix for that is to fix that line, so that the test itself
> can run under any sane POSIX shell, isn't it?  The test in turn may
> need to run git-remote-testgit, which, without J6t's updates, only
> is usable under bash, but to make sure the test will choke on
> absence of bash, the existing check should be sufficient, no?

Curiously enough, there were a few instances of the correct "set and export environment explicitly during the life of subshell" construct already in the script. I found only this one as problematic.

Does it fix your issue without your change?

It is a separate issue to port git-remote-testgit to POSIX (J6t already has a two part draft), move it to git-remote-testgit.sh, and get its shebang line preprocessed like all other shell scripts. I think it is worth doing.

Takers?
 t/t5801-remote-helpers.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index 4dcf744..c956abd 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -118,7 +118,9 @@ test_expect_success 'pushing without refspecs' '
 	(cd local2 &&
 	echo content >>file &&
 	git commit -a -m ten &&
-	GIT_REMOTE_TESTGIT_REFSPEC="" test_must_fail git push 2>../error) &&
+	GIT_REMOTE_TESTGIT_REFSPEC="" &&
+	export GIT_REMOTE_TESTGIT_REFSPEC &&
+	test_must_fail git push 2>../error) &&
 	grep "remote-helper doesn.t support push; refspec needed" error
 '
 
Previous: Junio C HamanoNext: Michael J Gruber
Message 9 of 11 in “t5801: properly test the test shell”
  1. t5801: properly test the test shellMichael J Gruber, Apr 25, 2013
  2. Johannes SixtApr 25, 2013
  3. Michael J GruberApr 25, 2013
  4. Johannes SixtApr 25, 2013
  5. Junio C HamanoApr 25, 2013
  6. Torsten BögershausenApr 25, 2013
  7. Junio C HamanoApr 25, 2013
  8. Junio C HamanoApr 25, 2013
  9. Junio C HamanoApr 25, 2013
  10. Michael J GruberApr 26, 2013
  11. Junio C HamanoApr 26, 2013

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.