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

Re: [PATCH 8/8] Fix tests breaking when checkout path contains shell metacharacters

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Apr 10, 2008, 06:49 UTC
Message-ID
<47FDB85F.9070503@viscovery.net>
In-Reply-To
<20080410063028.GA12562@shion.is.fushizen.net>
Bryan Donlan schrieb:
> (did you mean to send the original reply to the list as well? not ccing for
>  now, feel free to re-send/forward to the list if you like)

Sorry, yes, I hit the wrong button. I'm lazy again and simply resend this reply with the complete Cc list, with everything quoted.

Show 57 quoted lines
> On Wed, Apr 09, 2008 at 09:01:12AM +0200, Johannes Sixt wrote:
>> Bryan Donlan schrieb:
>>> -		GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
>>> +		GIT_WORK_TREE="$(pwd)" GIT_DIR=git-dir-wt-1.git git init
>> This ...
>>
>>> -HERE=`pwd`
>>> +HERE="$(pwd)"
>> ... and this and a lot of similar cases shouldn't be required: The RHS of
>> an assignment does not undergo word-splitting.
> 
> Will fix.
> 
>>> -export GIT_DIR=$(pwd)/repo.git
>>> -export GIT_CONFIG=$GIT_DIR/config
>>> +export GIT_DIR="$(pwd)/repo.git"
>>> +export GIT_CONFIG="$GIT_DIR/config"
>> This, OTOH, is not an assignment, and the change is to the better. But not
>> all shells support export with assignment. Hence this should be changed to
>> the form
>>
>> 	GIT_DIR=$(pwd)/repo.git
>> 	GIT_CONFIG=$GIT_DIR/config
>> 	export GIT_DIR GIT_CONFIG
>>
>> (and similar cases at other places).
> 
> I'll break these bits out into another patch in the sequence and fix.
> 
>>>  test_expect_success  ".rev_db auto-converted to .rev_map.UUID" "
>>>  	git-svn fetch -i trunk &&
>>> -	test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> -	expect=\"\$(ls $GIT_DIR/svn/trunk/.rev_map.*)\" &&
>>> +	test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> +	expect=\"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_map.*)\" &&
>>>  	test -n \"\$expect\" &&
>>> -	rev_db=\$(echo \$expect | sed -e 's,_map,_db,') &&
>>> -	convert_to_rev_db \$expect \$rev_db &&
>>> -	rm -f \$expect &&
>>> -	test -f \$rev_db &&
>>> +	rev_db=\"\$(echo \$expect | sed -e 's,_map,_db,')\" &&
>>> +	convert_to_rev_db \"\$expect\" \"\$rev_db\" &&
>>> +	rm -f \"\$expect\" &&
>>> +	test -f \"\$rev_db\" &&
>>>  	git-svn fetch -i trunk &&
>>> -	test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> -	test ! -e $GIT_DIR/svn/trunk/.rev_db &&
>>> -	test -f \$expect
>>> +	test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> +	test ! -e \"\$GIT_DIR\"/svn/trunk/.rev_db &&
>>> +	test -f \"\$expect\"
>>>  	"
>> While looking at this test: Wouldn't it be easier to just place the whole
>> thing (and probably similar cases, too) in single-quotes?
> 
> To be honest, I fixed all the git-svn tests with a suitably clever vim s///
> expression, so at the time this way was actually easier :)

Fair enough. If you still have the statement in you vim history, it's worth quoting in the commit message. It's another piece of information that helps reviewing.

> (Essentially all of the git-svn tests were broken, and it was a little
>  annoying to fix them all by hand... though of course I verified the
>  results)
-- Hannes
Previous: Johannes SixtNext: Bryan Donlan
Message 58 of 60 in “Fix git's test suite to pass when the path contains spaces”
  1. 0/8 Fix git's test suite to pass when the path contains spacesBryan Donlan, Apr 9, 2008
  2. 1/8 git-rebase.sh: Fix --merge --abort failures when path contains whitespaceBryan Donlan, Apr 9, 2008
  3. 2/8 config.c: Escape backslashes in section names properlyBryan Donlan, Apr 9, 2008
  4. 3/8 git-send-email.perl: Handle shell metacharacters in $EDITOR properlyBryan Donlan, Apr 9, 2008
  5. 4/8 test-lib.sh: Fix some missing path quotingBryan Donlan, Apr 9, 2008
  6. 5/8 test-lib.sh: Add a test_set_editor function to safely set $VISUALBryan Donlan, Apr 9, 2008
  7. 6/8 lib-git-svn.sh: Fix quoting issues with paths containing shell metacharactersBryan Donlan, Apr 9, 2008
  8. 7/8 Use test_set_editor in t9001-send-email.shBryan Donlan, Apr 9, 2008
  9. 8/8 Fix tests breaking when checkout path contains shell metacharactersBryan Donlan, Apr 9, 2008
  10. Johannes SixtApr 9, 2008
  11. Bryan DonlanApr 9, 2008
  12. Junio C HamanoApr 9, 2008
  13. Johannes SixtApr 9, 2008
  14. Johannes SixtApr 9, 2008
  15. Bryan DonlanApr 9, 2008
  16. Junio C HamanoApr 10, 2008
  17. Johannes SixtApr 9, 2008
  18. Bryan DonlanApr 9, 2008
  19. Johannes SixtApr 9, 2008
  20. Junio C HamanoApr 9, 2008
  21. Johannes SixtApr 9, 2008
  22. Bryan DonlanApr 9, 2008
  23. Johannes SixtApr 9, 2008
  24. Bryan DonlanApr 9, 2008
  25. Johannes SixtApr 10, 2008
  26. 00/10 Fix git's test suite to pass when the path contains spacesBryan Donlan, Apr 10, 2008
  27. 01/10 git-rebase.sh: Fix --merge --abort failures when path contains whitespaceBryan Donlan, Apr 10, 2008
  28. 02/10 config.c: Escape backslashes in section names properlyBryan Donlan, Apr 10, 2008
  29. 03/10 git-send-email.perl: Handle shell metacharacters in $EDITOR properlyBryan Donlan, Apr 10, 2008
  30. 04/10 test-lib.sh: Add a test_set_editor function to safely set $VISUALBryan Donlan, Apr 10, 2008
  31. 05/10 Use test_set_editor in t9001-send-email.shBryan Donlan, Apr 10, 2008
  32. 06/10 test-lib.sh: Fix some missing path quotingBryan Donlan, Apr 10, 2008
  33. 07/10 lib-git-svn.sh: Fix quoting issues with paths containing shell metacharactersBryan Donlan, Apr 10, 2008
  34. 08/10 Don't use the export NAME=value form in the test scripts.Bryan Donlan, Apr 10, 2008
  35. 09/10 Fix tests breaking when checkout path contains shell metacharactersBryan Donlan, Apr 10, 2008
  36. 10/10 Rename the test trash directory to contain shell metacharacters.Bryan Donlan, Apr 10, 2008
  37. Junio C HamanoApr 10, 2008
  38. Bryan DonlanApr 10, 2008
  39. Junio C HamanoApr 11, 2008
  40. 00/10 Fix git's test suite to pass when the path contains spacesBryan Donlan, May 4, 2008
  41. 01/10 git-rebase.sh: Fix --merge --abort failures when path contains whitespaceBryan Donlan, May 4, 2008
  42. 02/10 config.c: Escape backslashes in section names properlyBryan Donlan, May 4, 2008
  43. 03/10 git-send-email.perl: Handle shell metacharacters in $EDITOR properlyBryan Donlan, May 4, 2008
  44. 04/10 test-lib.sh: Add a test_set_editor function to safely set $VISUALBryan Donlan, May 4, 2008
  45. 05/10 Use test_set_editor in t9001-send-email.shBryan Donlan, May 4, 2008
  46. 06/10 test-lib.sh: Fix some missing path quotingBryan Donlan, May 4, 2008
  47. 07/10 lib-git-svn.sh: Fix quoting issues with paths containing shell metacharactersBryan Donlan, May 4, 2008
  48. 08/10 Don't use the export NAME=value form in the test scripts.Bryan Donlan, May 4, 2008
  49. 09/10 Fix tests breaking when checkout path contains shell metacharactersBryan Donlan, May 4, 2008
  50. 10/10 Rename the test trash directory to contain spaces.Bryan Donlan, May 4, 2008
  51. Johannes SixtMay 5, 2008
  52. Johannes SixtMay 5, 2008
  53. Bryan DonlanMay 5, 2008
  54. Johannes SixtMay 5, 2008
  55. Johannes SixtMay 5, 2008
  56. Bryan DonlanMay 5, 2008
  57. Johannes SixtMay 5, 2008
  58. Johannes SixtApr 10, 2008
  59. Bryan DonlanApr 10, 2008
  60. Junio C HamanoApr 10, 2008

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.