Fossil SCM
Only print the SSH command once and also the forced newline so the Round-trips information stays on one line.
Commit
72877d8e5170627f332b84a2a1a4ae2e27820a1e
Parent
18caf358f0868ea…
1 file changed
+9
-3
+9
-3
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -105,10 +105,11 @@ | ||
| 105 | 105 | */ |
| 106 | 106 | int transport_ssh_open(void){ |
| 107 | 107 | /* For SSH we need to create and run SSH fossil http |
| 108 | 108 | ** to talk to the remote machine. |
| 109 | 109 | */ |
| 110 | + static int fPrintSshCmd = 1; /* Print SSH command only once */ | |
| 110 | 111 | const char *zSsh; /* The base SSH command */ |
| 111 | 112 | Blob zCmd; /* The SSH command */ |
| 112 | 113 | char *zHost; /* The host name to contact */ |
| 113 | 114 | int n; /* Size of prefix string */ |
| 114 | 115 | |
| @@ -119,12 +120,14 @@ | ||
| 119 | 120 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 120 | 121 | #else |
| 121 | 122 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 122 | 123 | #endif |
| 123 | 124 | } |
| 124 | - fossil_force_newline(); | |
| 125 | - fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 125 | + if( fPrintSshCmd ){ | |
| 126 | + fossil_force_newline(); | |
| 127 | + fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 128 | + } | |
| 126 | 129 | if( g.urlUser && g.urlUser[0] ){ |
| 127 | 130 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 128 | 131 | #ifdef __MINGW32__ |
| 129 | 132 | /* Only win32 (and specifically PLINK.EXE) support the -pw option */ |
| 130 | 133 | if( g.urlPasswd && g.urlPasswd[0] ){ |
| @@ -159,11 +162,14 @@ | ||
| 159 | 162 | blob_append(&zCmd, " http", 5); |
| 160 | 163 | if( g.urlPath && g.urlPath[0] ){ |
| 161 | 164 | blob_append(&zCmd, " ", 1); |
| 162 | 165 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 163 | 166 | } |
| 164 | - fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ | |
| 167 | + if( fPrintSshCmd ){ | |
| 168 | + fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ | |
| 169 | + fPrintSshCmd = 0; | |
| 170 | + } | |
| 165 | 171 | free(zHost); |
| 166 | 172 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 167 | 173 | if( sshPid==0 ){ |
| 168 | 174 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 169 | 175 | } |
| 170 | 176 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -105,10 +105,11 @@ | |
| 105 | */ |
| 106 | int transport_ssh_open(void){ |
| 107 | /* For SSH we need to create and run SSH fossil http |
| 108 | ** to talk to the remote machine. |
| 109 | */ |
| 110 | const char *zSsh; /* The base SSH command */ |
| 111 | Blob zCmd; /* The SSH command */ |
| 112 | char *zHost; /* The host name to contact */ |
| 113 | int n; /* Size of prefix string */ |
| 114 | |
| @@ -119,12 +120,14 @@ | |
| 119 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 120 | #else |
| 121 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 122 | #endif |
| 123 | } |
| 124 | fossil_force_newline(); |
| 125 | fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ |
| 126 | if( g.urlUser && g.urlUser[0] ){ |
| 127 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 128 | #ifdef __MINGW32__ |
| 129 | /* Only win32 (and specifically PLINK.EXE) support the -pw option */ |
| 130 | if( g.urlPasswd && g.urlPasswd[0] ){ |
| @@ -159,11 +162,14 @@ | |
| 159 | blob_append(&zCmd, " http", 5); |
| 160 | if( g.urlPath && g.urlPath[0] ){ |
| 161 | blob_append(&zCmd, " ", 1); |
| 162 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 163 | } |
| 164 | fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ |
| 165 | free(zHost); |
| 166 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 167 | if( sshPid==0 ){ |
| 168 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 169 | } |
| 170 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -105,10 +105,11 @@ | |
| 105 | */ |
| 106 | int transport_ssh_open(void){ |
| 107 | /* For SSH we need to create and run SSH fossil http |
| 108 | ** to talk to the remote machine. |
| 109 | */ |
| 110 | static int fPrintSshCmd = 1; /* Print SSH command only once */ |
| 111 | const char *zSsh; /* The base SSH command */ |
| 112 | Blob zCmd; /* The SSH command */ |
| 113 | char *zHost; /* The host name to contact */ |
| 114 | int n; /* Size of prefix string */ |
| 115 | |
| @@ -119,12 +120,14 @@ | |
| 120 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 121 | #else |
| 122 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 123 | #endif |
| 124 | } |
| 125 | if( fPrintSshCmd ){ |
| 126 | fossil_force_newline(); |
| 127 | fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ |
| 128 | } |
| 129 | if( g.urlUser && g.urlUser[0] ){ |
| 130 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 131 | #ifdef __MINGW32__ |
| 132 | /* Only win32 (and specifically PLINK.EXE) support the -pw option */ |
| 133 | if( g.urlPasswd && g.urlPasswd[0] ){ |
| @@ -159,11 +162,14 @@ | |
| 162 | blob_append(&zCmd, " http", 5); |
| 163 | if( g.urlPath && g.urlPath[0] ){ |
| 164 | blob_append(&zCmd, " ", 1); |
| 165 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 166 | } |
| 167 | if( fPrintSshCmd ){ |
| 168 | fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ |
| 169 | fPrintSshCmd = 0; |
| 170 | } |
| 171 | free(zHost); |
| 172 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 173 | if( sshPid==0 ){ |
| 174 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 175 | } |
| 176 |