t5601: check ssh command only with protocol v0

When running the SSH command as part of a fetch, Git will write "SendEnv GIT_PROTOCOL" as an option if protocol v1 or v2 is used, but not v0. Update all tests that check this to run Git with GIT_TEST_PROTOCOL_VERSION=0. I chose not to do a more thorough fix (for example, checking the value of GIT_TEST_PROTOCOL_VERSION to see if the SendEnv check needs to be done) because a set of patches [1] that unifies the handling of SSH options, including writing "SendEnv GIT_PROTOCOL" regardless of protocol version, is in progress. When that is done, this patch should be reverted, since the functionality in here is no longer needed. As of this patch, all tests pass if GIT_TEST_PROTOCOL_VERSION is set to 1. [1] https://public-inbox.org/git/cover.1545342797.git.steadmon@google.com/ Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Tan committed Feb 25, 2019 at 13:54 UTC 3a5728dccaaab0741059cce12f9a58ec674f7c4e
1 file changed +8 -8
t/t5601-clone.sh
+8 -8
@@ -345,7 +345,7 @@ expect_ssh () {
345 }
346
347 test_expect_success 'clone myhost:src uses ssh' '
348 - git clone myhost:src ssh-clone &&
348 + GIT_TEST_PROTOCOL_VERSION=0 git clone myhost:src ssh-clone &&
349 expect_ssh myhost src
350 '
351
@@ -356,12 +356,12 @@ test_expect_success !MINGW,!CYGWIN 'clone local path foo:bar' '
356 '
357
358 test_expect_success 'bracketed hostnames are still ssh' '
359 - git clone "[myhost:123]:src" ssh-bracket-clone &&
359 + GIT_TEST_PROTOCOL_VERSION=0 git clone "[myhost:123]:src" ssh-bracket-clone &&
360 expect_ssh "-p 123" myhost src
361 '
362
363 test_expect_success 'OpenSSH variant passes -4' '
364 - git clone -4 "[myhost:123]:src" ssh-ipv4-clone &&
364 + GIT_TEST_PROTOCOL_VERSION=0 git clone -4 "[myhost:123]:src" ssh-ipv4-clone &&
365 expect_ssh "-4 -p 123" myhost src
366 '
367
@@ -405,7 +405,7 @@ test_expect_success 'OpenSSH-like uplink is treated as ssh' '
405 test_when_finished "rm -f \"\$TRASH_DIRECTORY/uplink\"" &&
406 GIT_SSH="$TRASH_DIRECTORY/uplink" &&
407 test_when_finished "GIT_SSH=\"\$TRASH_DIRECTORY/ssh\$X\"" &&
408 - git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
408 + GIT_TEST_PROTOCOL_VERSION=0 git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
409 expect_ssh "-p 123" myhost src
410 '
411
@@ -444,14 +444,14 @@ test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' '
444
445 test_expect_success 'GIT_SSH_VARIANT overrides plink detection' '
446 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
447 - GIT_SSH_VARIANT=ssh \
448 - git clone "[myhost:123]:src" ssh-bracket-clone-variant-1 &&
447 + GIT_TEST_PROTOCOL_VERSION=0 GIT_SSH_VARIANT=ssh \
448 + git clone "[myhost:123]:src" ssh-bracket-clone-variant-1 &&
449 expect_ssh "-p 123" myhost src
450 '
451
452 test_expect_success 'ssh.variant overrides plink detection' '
453 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
454 - git -c ssh.variant=ssh \
454 + GIT_TEST_PROTOCOL_VERSION=0 git -c ssh.variant=ssh \
455 clone "[myhost:123]:src" ssh-bracket-clone-variant-2 &&
456 expect_ssh "-p 123" myhost src
457 '
@@ -482,7 +482,7 @@ counter=0
482 # $3 path
483 test_clone_url () {
484 counter=$(($counter + 1))
485 - test_might_fail git clone "$1" tmp$counter &&
485 + test_might_fail env GIT_TEST_PROTOCOL_VERSION=0 git clone "$1" tmp$counter &&
486 shift &&
487 expect_ssh "$@"
488 }