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 <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2017-07-19 22:33:00 +02:00
parent ca127dae81
commit 40023e58cd
3 changed files with 7 additions and 4 deletions

View File

@@ -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);

View File

@@ -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)

View File

@@ -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
'