t5500: show user name and host in diag-url
The URL for ssh may have include a username before the hostname, like ssh://user@host/repo. When literal IPV6 addresses are used together with a username, the substring "user@[::1]" must be converted into "user@::1". Make that conversion visible for the user, and write userandhost in the diagnostics Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
9f6976528b
commit
3f55ccab8e
31
connect.c
31
connect.c
@ -675,7 +675,7 @@ struct child_process *git_connect(int fd[2], const char *url,
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
|
||||
protocol = parse_connect_url(url, &hostandport, &path);
|
||||
if (flags & CONNECT_DIAG_URL) {
|
||||
if ((flags & CONNECT_DIAG_URL) && (protocol != PROTO_SSH)) {
|
||||
printf("Diag: url=%s\n", url ? url : "NULL");
|
||||
printf("Diag: protocol=%s\n", prot_name(protocol));
|
||||
printf("Diag: hostandport=%s\n", hostandport ? hostandport : "NULL");
|
||||
@ -719,18 +719,29 @@ struct child_process *git_connect(int fd[2], const char *url,
|
||||
get_host_and_port(&ssh_host, &port);
|
||||
if (!port)
|
||||
port = get_port(ssh_host);
|
||||
if (flags & CONNECT_DIAG_URL) {
|
||||
printf("Diag: url=%s\n", url ? url : "NULL");
|
||||
printf("Diag: protocol=%s\n", prot_name(protocol));
|
||||
printf("Diag: userandhost=%s\n", ssh_host ? ssh_host : "NULL");
|
||||
printf("Diag: port=%s\n", port ? port : "NONE");
|
||||
printf("Diag: path=%s\n", path ? path : "NULL");
|
||||
|
||||
if (!ssh) ssh = "ssh";
|
||||
free(hostandport);
|
||||
free(path);
|
||||
return NULL;
|
||||
} else {
|
||||
if (!ssh) ssh = "ssh";
|
||||
|
||||
argv_array_push(&conn->args, ssh);
|
||||
if (putty && !strcasestr(ssh, "tortoiseplink"))
|
||||
argv_array_push(&conn->args, "-batch");
|
||||
if (port) {
|
||||
/* P is for PuTTY, p is for OpenSSH */
|
||||
argv_array_push(&conn->args, putty ? "-P" : "-p");
|
||||
argv_array_push(&conn->args, port);
|
||||
argv_array_push(&conn->args, ssh);
|
||||
if (putty && !strcasestr(ssh, "tortoiseplink"))
|
||||
argv_array_push(&conn->args, "-batch");
|
||||
if (port) {
|
||||
/* P is for PuTTY, p is for OpenSSH */
|
||||
argv_array_push(&conn->args, putty ? "-P" : "-p");
|
||||
argv_array_push(&conn->args, port);
|
||||
}
|
||||
argv_array_push(&conn->args, ssh_host);
|
||||
}
|
||||
argv_array_push(&conn->args, ssh_host);
|
||||
} else {
|
||||
/* remove repo-local variables from the environment */
|
||||
conn->env = local_repo_env;
|
||||
|
||||
Reference in New Issue
Block a user