diff --git a/connect.c b/connect.c index e78d3f43d8..d2ef958f40 100644 --- a/connect.c +++ b/connect.c @@ -825,6 +825,9 @@ struct child_process *git_connect(int fd[2], const char *url, child_process_init(conn); strbuf_addstr(&cmd, prog); + /* Prefer the builtin */ + if (starts_with(prog, "git-")) + cmd.buf[3] = ' '; strbuf_addch(&cmd, ' '); sq_quote_buf(&cmd, path); diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 9c56f771b6..cbe9f33319 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: $1 git upload-pack '$2'" ;; 3) - echo "ssh: $1 $2 git-upload-pack '$3'" + echo "ssh: $1 $2 git upload-pack '$3'" ;; *) - echo "ssh: $1 $2 git-upload-pack '$3' $4" + echo "ssh: $1 $2 git upload-pack '$3' $4" esac } >"$TRASH_DIRECTORY/ssh-expect" && (cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output) diff --git a/t/t5602-clone-remote-exec.sh b/t/t5602-clone-remote-exec.sh index cbcceab9d5..315cf97467 100755 --- a/t/t5602-clone-remote-exec.sh +++ b/t/t5602-clone-remote-exec.sh @@ -13,7 +13,7 @@ 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 "localhost git upload-pack '\''/path/to/repo'\''" >expected && test_cmp expected not_ssh_output '