@matheusbsbs / matheus-bagliano / commits / 837c876713
Fork 0

Propagate -u/--upload-pack option of "git clone" to transport.

The -u option to override the remote system's path to git-upload-pack was being ignored by "git clone"; caused by a missing call to transport_set_option to set TRANS_OPT_UPLOADPACK. Presumably this crept in when git-clone was converted from shell to C. Signed-off-by: Steve Haslam <shaslam@lastminute.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Steve Haslam committed Jul 25, 2008 at 18:51 UTC 837c8767130ec71089e654f92cf24e8277a3bda5
2 files changed +30
builtin-clone.c
+4
@@ -480,6 +480,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
480 if (option_quiet)
481 transport->verbose = -1;
482
483 + if (option_upload_pack)
484 + transport_set_option(transport, TRANS_OPT_UPLOADPACK,
485 + option_upload_pack);
486 +
487 refs = transport_get_remote_refs(transport);
488 transport_fetch_refs(transport, refs);
489 }
t/t5602-clone-remote-exec.sh new
+26
@@ -0,0 +1,26 @@
1 +#!/bin/sh
2 +
3 +test_description=clone
4 +
5 +. ./test-lib.sh
6 +
7 +test_expect_success setup '
8 + echo "#!/bin/sh" > not_ssh
9 + echo "echo \"\$*\" > not_ssh_output" >> not_ssh
10 + echo "exit 1" >> not_ssh
11 + chmod +x not_ssh
12 +'
13 +
14 +test_expect_success 'clone calls git-upload-pack unqualified with no -u option' '
15 + GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk
16 + echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected
17 + test_cmp expected not_ssh_output
18 +'
19 +
20 +test_expect_success 'clone calls specified git-upload-pack with -u option' '
21 + GIT_SSH=./not_ssh git clone -u /something/bin/git-upload-pack localhost:/path/to/repo junk
22 + echo "localhost /something/bin/git-upload-pack '\''/path/to/repo'\''" >expected
23 + test_cmp expected not_ssh_output
24 +'
25 +
26 +test_done