Merge branch 'sf/putty-w-args'
authorJunio C Hamano <gitster@pobox.com>
Thu, 20 Apr 2017 04:37:24 +0000 (21:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Apr 2017 04:37:24 +0000 (21:37 -0700)
* sf/putty-w-args:
connect.c: handle errors from split_cmdline

connect.c
t/t5601-clone.sh
index 6afde189a3affdc4e196f506d0f561ac260892a9..568a35f754e41d54dc0e7133bbfaa0d1d02ccb27 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -730,7 +730,7 @@ static void handle_ssh_variant(const char *ssh_command, int is_cmdline,
                const char **ssh_argv;
 
                p = xstrdup(ssh_command);
-               if (split_cmdline(p, &ssh_argv)) {
+               if (split_cmdline(p, &ssh_argv) > 0) {
                        variant = basename((char *)ssh_argv[0]);
                        /*
                         * At this point, variant points into the buffer
index b52b8acf9859b0084ea10ebf184ed95cafb0b2d8..9c56f771b619e4bb931ce3d34a5f9325b8f61e90 100755 (executable)
@@ -427,6 +427,12 @@ test_expect_success 'GIT_SSH_VARIANT overrides plink to tortoiseplink' '
        expect_ssh "-batch -P 123" myhost src
 '
 
+test_expect_success 'clean failure on broken quoting' '
+       test_must_fail \
+               env GIT_SSH_COMMAND="${SQ}plink.exe -v" \
+               git clone "[myhost:123]:src" sq-failure
+'
+
 # Reset the GIT_SSH environment variable for clone tests.
 setup_ssh_wrapper