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

[RFC 4/7] t: fix ssh tests to cope with using '-o SendEnv=GIT_PROTOCOL'

From
BWBrandon Williams <bmwill@google.com>
Date
Aug 24, 2017, 22:53 UTC
Message-ID
<20170824225328.8174-5-bmwill@google.com>
In-Reply-To
<20170824225328.8174-1-bmwill@google.com>

Update some of our tests to cope with ssh being launched with the option to send the protocol version.

Signed-off-by: Brandon Williams <bmwill@google.com>
---
 t/lib-proto-disable.sh       |  1 +
 t/t5601-clone.sh             | 10 +++++-----
 t/t5602-clone-remote-exec.sh |  4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/t/lib-proto-disable.sh b/t/lib-proto-disable.sh
index 83babe57d..d19c88f96 100644
--- a/t/lib-proto-disable.sh
+++ b/t/lib-proto-disable.sh
@@ -194,6 +194,7 @@ setup_ssh_wrapper () {
 	test_expect_success 'setup ssh wrapper' '
 		write_script ssh-wrapper <<-\EOF &&
 		echo >&2 "ssh: $*"
+		shift; shift
 		host=$1; shift
 		cd "$TRASH_DIRECTORY/$host" &&
 		eval "$*"
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 9c56f771b..7e65013c5 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -332,13 +332,13 @@ expect_ssh () {
 		1)
 			;;
 		2)
-			echo "ssh: $1 git-upload-pack '$2'"
+			echo "ssh: -o SendEnv=GIT_PROTOCOL $1 git-upload-pack '$2'"
 			;;
 		3)
-			echo "ssh: $1 $2 git-upload-pack '$3'"
+			echo "ssh: -o SendEnv=GIT_PROTOCOL $1 $2 git-upload-pack '$3'"
 			;;
 		*)
-			echo "ssh: $1 $2 git-upload-pack '$3' $4"
+			echo "ssh: $1 -o SendEnv=GIT_PROTOCOL $2 $3 git-upload-pack '$4'"
 		esac
 	} >"$TRASH_DIRECTORY/ssh-expect" &&
 	(cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output)
@@ -390,7 +390,7 @@ test_expect_success 'double quoted plink.exe in GIT_SSH_COMMAND' '
 	copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" &&
 	GIT_SSH_COMMAND="\"$TRASH_DIRECTORY/plink.exe\" -v" \
 		git clone "[myhost:123]:src" ssh-bracket-clone-plink-3 &&
-	expect_ssh "-v -P 123" myhost src
+	expect_ssh "-v" "-P 123" myhost src
 '
 
 SQ="'"
@@ -398,7 +398,7 @@ test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' '
 	copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" &&
 	GIT_SSH_COMMAND="$SQ$TRASH_DIRECTORY/plink.exe$SQ -v" \
 		git clone "[myhost:123]:src" ssh-bracket-clone-plink-4 &&
-	expect_ssh "-v -P 123" myhost src
+	expect_ssh "-v" "-P 123" myhost src
 '
 
 test_expect_success 'GIT_SSH_VARIANT overrides plink detection' '
diff --git a/t/t5602-clone-remote-exec.sh b/t/t5602-clone-remote-exec.sh
index cbcceab9d..b0d80cadd 100755
--- a/t/t5602-clone-remote-exec.sh
+++ b/t/t5602-clone-remote-exec.sh
@@ -13,14 +13,14 @@ test_expect_success setup '
 
 test_expect_success 'clone calls git upload-pack unqualified with no -u option' '
 	test_must_fail env GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk &&
-	echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected &&
+	echo "-o SendEnv=GIT_PROTOCOL localhost git-upload-pack '\''/path/to/repo'\''" >expected &&
 	test_cmp expected not_ssh_output
 '
 
 test_expect_success 'clone calls specified git upload-pack with -u option' '
 	test_must_fail env GIT_SSH=./not_ssh \
 		git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk &&
-	echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected &&
+	echo "-o SendEnv=GIT_PROTOCOL localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected &&
 	test_cmp expected not_ssh_output
 '
 
-- 
2.14.1.342.g6490525c54-goog
Previous: Brandon WilliamsNext: Junio C Hamano
Message 14 of 31 in “[RFC 0/7] transitioning to protocol v2”
  1. Brandon WilliamsAug 24, 2017
  2. 1/7 pkt-line: add packet_write functionBrandon Williams, Aug 24, 2017
  3. 2/7 pkt-line: add strbuf_packet_readBrandon Williams, Aug 24, 2017
  4. 3/7 protocol: tell server that the client understands v2Brandon Williams, Aug 24, 2017
  5. Junio C HamanoAug 25, 2017
  6. Brandon WilliamsAug 25, 2017
  7. Brandon WilliamsAug 25, 2017
  8. 5/7 http: send Git-Protocol-Version headerBrandon Williams, Aug 24, 2017
  9. Kevin DaudtAug 30, 2017
  10. 6/7 transport: teach client to recognize v2 server responseBrandon Williams, Aug 24, 2017
  11. 7/7 upload-pack: ack version 2Brandon Williams, Aug 24, 2017
  12. Bryan TurnerSep 1, 2017
  13. Brandon WilliamsSep 1, 2017
  14. 4/7 t: fix ssh tests to cope with using '-o SendEnv=GIT_PROTOCOL'Brandon Williams, Aug 24, 2017
  15. Junio C HamanoAug 25, 2017
  16. Stefan BellerAug 25, 2017
  17. Junio C HamanoAug 25, 2017
  18. Jeff KingAug 25, 2017
  19. Jeff KingAug 25, 2017
  20. Jonathan NiederAug 25, 2017
  21. Jeff KingAug 25, 2017
  22. Brandon WilliamsAug 25, 2017
  23. Jeff HostetlerAug 29, 2017
  24. Brandon WilliamsAug 29, 2017
  25. Jeff KingAug 30, 2017
  26. Jeff HostetlerAug 30, 2017
  27. Brandon WilliamsAug 30, 2017
  28. Junio C HamanoAug 25, 2017
  29. Bryan TurnerAug 30, 2017
  30. Brandon WilliamsAug 30, 2017
  31. Bryan TurnerSep 1, 2017

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.