From 40023e58cda656326287d77358514acb262b7484 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 19 Jul 2017 22:33:00 +0200 Subject: [PATCH] git_connect: prefer Git's builtins over dashed form This helps with minimal installations such as MinGit that refuse to waste .zip real estate by shipping identical copies of builtins (.zip files do not support hard links). Signed-off-by: Johannes Schindelin --- connect.c | 3 +++ t/t5601-clone.sh | 6 +++--- t/t5602-clone-remote-exec.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) 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 '