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

Re: [PATCH v6] git-p4: add config git-p4.pathEncoding

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 3, 2015, 17:03 UTC
Message-ID
<xmqqa8t3l9km.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1441271647-67824-2-git-send-email-larsxschneider@gmail.com>
larsxschneider@gmail.com writes:
Show 9 quoted lines
> +test_expect_success 'Clone repo containing iso8859-1 encoded paths without git-p4.pathEncoding' '
> +	git p4 clone --destination="$git" //depot &&
> +	test_when_finished cleanup_git &&
> +	(
> +		cd "$git" &&
> +		UTF8="$(printf "$UTF8_ESCAPED")" &&
> +		echo $UTF8 >expect &&
> +		git -c core.quotepath=false ls-files >actual &&
> +		test_must_fail test_cmp expect actual

I am not sure what this test wants to do. It is not inconceivable that future versions of "git p4 clone" becomes more intelligent to detect the need for git-p4.pathEncoding and set it, so the only effect to insist the comparison fails is to block future advance in that direction.

Besides, "test_must_fail test_cmp" looks like a strange thing to say. "! test_cmp expect actual" perhaps.

Even better, expect that "expect" and "actual" becomes the same, but mark the test itself to expect failure, to say "it ought to work this way in the ideal world, but we know the system currently does not pass this test".

I'm tempted to suggest squashing the following in.  Thoughts?
 t/t9822-git-p4-path-encoding.sh | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/t/t9822-git-p4-path-encoding.sh b/t/t9822-git-p4-path-encoding.sh
index e507ad7..2d652d89 100755
--- a/t/t9822-git-p4-path-encoding.sh
+++ b/t/t9822-git-p4-path-encoding.sh
@@ -21,15 +21,15 @@ test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
 	)
 '
 
-test_expect_success 'Clone repo containing iso8859-1 encoded paths without git-p4.pathEncoding' '
+test_expect_failure 'Clone auto-detects depot with iso8859-1 paths' '
 	git p4 clone --destination="$git" //depot &&
 	test_when_finished cleanup_git &&
 	(
 		cd "$git" &&
 		UTF8="$(printf "$UTF8_ESCAPED")" &&
-		echo $UTF8 >expect &&
+		echo "$UTF8" >expect &&
 		git -c core.quotepath=false ls-files >actual &&
-		test_must_fail test_cmp expect actual
+		test_cmp expect actual
 	)
 '
 
@@ -39,16 +39,15 @@ test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.p
 	(
 		cd "$git" &&
 		git init . &&
-		test_config git-p4.pathEncoding iso8859-1 &&
+		git config git-p4.pathEncoding iso8859-1 &&
 		git p4 clone --use-client-spec --destination="$git" //depot &&
 		UTF8="$(printf "$UTF8_ESCAPED")" &&
-		echo $UTF8 >expect &&
+		echo "$UTF8" >expect &&
 		git -c core.quotepath=false ls-files >actual &&
 		test_cmp expect actual &&
-		cat >expect <<-\EOF &&
-		content123
-		EOF
-		cat $UTF8 >actual &&
+
+		echo content123 >expect &&
+		cat "$UTF8" >actual &&
 		test_cmp expect actual
 	)
 '
Previous: larsxschneider@gmail.comNext: Lars Schneider
Message 3 of 5 in “git-p4: add config git-p4.pathEncoding”
  1. git-p4: add config git-p4.pathEncodinglarsxschneider@gmail.com, Sep 3, 2015
  2. git-p4: add config git-p4.pathEncodinglarsxschneider@gmail.com, Sep 3, 2015
  3. Junio C HamanoSep 3, 2015
  4. Lars SchneiderSep 3, 2015
  5. Junio C HamanoSep 3, 2015

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.