Fossil SCM
Much needed cleanup of command-line option handling. Improve sync handling of SSH user. Bring in change for less verbose SSH output.
Commit
955b39ee9f36f4a7212dc00c5656da8946717473
Parent
f4e882f5d3e7be5…
9 files changed
-1
+4
-8
+4
-8
+13
-9
+13
-9
+2
-4
+2
-4
+4
+4
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1352,11 +1352,10 @@ | ||
| 1352 | 1352 | } |
| 1353 | 1353 | } |
| 1354 | 1354 | sCiInfo.zDateOvrd = find_option("date-override",0,1); |
| 1355 | 1355 | sCiInfo.zUserOvrd = find_option("user-override",0,1); |
| 1356 | 1356 | db_must_be_within_tree(); |
| 1357 | - clone_ssh_db_options(); | |
| 1358 | 1357 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1359 | 1358 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1360 | 1359 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1361 | 1360 | outputManifest = db_get_boolean("manifest", 0); |
| 1362 | 1361 | verify_all_options(); |
| 1363 | 1362 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1352,11 +1352,10 @@ | |
| 1352 | } |
| 1353 | } |
| 1354 | sCiInfo.zDateOvrd = find_option("date-override",0,1); |
| 1355 | sCiInfo.zUserOvrd = find_option("user-override",0,1); |
| 1356 | db_must_be_within_tree(); |
| 1357 | clone_ssh_db_options(); |
| 1358 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1359 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1360 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1361 | outputManifest = db_get_boolean("manifest", 0); |
| 1362 | verify_all_options(); |
| 1363 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1352,11 +1352,10 @@ | |
| 1352 | } |
| 1353 | } |
| 1354 | sCiInfo.zDateOvrd = find_option("date-override",0,1); |
| 1355 | sCiInfo.zUserOvrd = find_option("user-override",0,1); |
| 1356 | db_must_be_within_tree(); |
| 1357 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1358 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1359 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1360 | outputManifest = db_get_boolean("manifest", 0); |
| 1361 | verify_all_options(); |
| 1362 |
+4
-8
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -106,11 +106,11 @@ | ||
| 106 | 106 | const char *zDefaultUser; /* Optional name of the default user */ |
| 107 | 107 | int nErr = 0; |
| 108 | 108 | int bPrivate = 0; /* Also clone private branches */ |
| 109 | 109 | |
| 110 | 110 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 111 | - clone_ssh_options(); | |
| 111 | + clone_ssh_find_options(); | |
| 112 | 112 | url_proxy_options(); |
| 113 | 113 | if( g.argc < 4 ){ |
| 114 | 114 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 115 | 115 | } |
| 116 | 116 | db_open_config(0); |
| @@ -158,11 +158,11 @@ | ||
| 158 | 158 | "REPLACE INTO config(name,value,mtime)" |
| 159 | 159 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 160 | 160 | ); |
| 161 | 161 | url_enable_proxy(0); |
| 162 | 162 | url_get_password_if_needed(); |
| 163 | - clone_ssh_db_options(); | |
| 163 | + clone_ssh_db_set_options(); | |
| 164 | 164 | g.xlinkClusterOnly = 1; |
| 165 | 165 | nErr = client_sync(SYNC_CLONE | bPrivate,CONFIGSET_ALL,0); |
| 166 | 166 | g.xlinkClusterOnly = 0; |
| 167 | 167 | verify_cancel(); |
| 168 | 168 | db_end_transaction(0); |
| @@ -183,11 +183,11 @@ | ||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /* |
| 186 | 186 | ** Look for SSH clone command line options and setup in globals. |
| 187 | 187 | */ |
| 188 | -void clone_ssh_options(void){ | |
| 188 | +void clone_ssh_find_options(void){ | |
| 189 | 189 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 190 | 190 | const char *zSshCmd; /* SSH command string */ |
| 191 | 191 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 192 | 192 | |
| 193 | 193 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| @@ -206,20 +206,16 @@ | ||
| 206 | 206 | |
| 207 | 207 | /* |
| 208 | 208 | ** Set SSH options discovered in global variables (set from command line |
| 209 | 209 | ** options). If not found, attempt to retrieve from database if present. |
| 210 | 210 | */ |
| 211 | -void clone_ssh_db_options(void){ | |
| 211 | +void clone_ssh_db_set_options(void){ | |
| 212 | 212 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 213 | 213 | db_set("ssh-fossil", g.zSshFossilCmd, 0); |
| 214 | - }else{ | |
| 215 | - g.zSshFossilCmd = db_get("ssh-fossil", "fossil"); | |
| 216 | 214 | } |
| 217 | 215 | if( g.zSshCmd && g.zSshCmd[0] ){ |
| 218 | 216 | db_set("ssh-command", g.zSshCmd, 0); |
| 219 | 217 | } |
| 220 | 218 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 221 | 219 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 222 | - }else{ | |
| 223 | - g.zFossilUser = db_get("ssh-fossil-user", 0); | |
| 224 | 220 | } |
| 225 | 221 | } |
| 226 | 222 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -106,11 +106,11 @@ | |
| 106 | const char *zDefaultUser; /* Optional name of the default user */ |
| 107 | int nErr = 0; |
| 108 | int bPrivate = 0; /* Also clone private branches */ |
| 109 | |
| 110 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 111 | clone_ssh_options(); |
| 112 | url_proxy_options(); |
| 113 | if( g.argc < 4 ){ |
| 114 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 115 | } |
| 116 | db_open_config(0); |
| @@ -158,11 +158,11 @@ | |
| 158 | "REPLACE INTO config(name,value,mtime)" |
| 159 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 160 | ); |
| 161 | url_enable_proxy(0); |
| 162 | url_get_password_if_needed(); |
| 163 | clone_ssh_db_options(); |
| 164 | g.xlinkClusterOnly = 1; |
| 165 | nErr = client_sync(SYNC_CLONE | bPrivate,CONFIGSET_ALL,0); |
| 166 | g.xlinkClusterOnly = 0; |
| 167 | verify_cancel(); |
| 168 | db_end_transaction(0); |
| @@ -183,11 +183,11 @@ | |
| 183 | } |
| 184 | |
| 185 | /* |
| 186 | ** Look for SSH clone command line options and setup in globals. |
| 187 | */ |
| 188 | void clone_ssh_options(void){ |
| 189 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 190 | const char *zSshCmd; /* SSH command string */ |
| 191 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 192 | |
| 193 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| @@ -206,20 +206,16 @@ | |
| 206 | |
| 207 | /* |
| 208 | ** Set SSH options discovered in global variables (set from command line |
| 209 | ** options). If not found, attempt to retrieve from database if present. |
| 210 | */ |
| 211 | void clone_ssh_db_options(void){ |
| 212 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 213 | db_set("ssh-fossil", g.zSshFossilCmd, 0); |
| 214 | }else{ |
| 215 | g.zSshFossilCmd = db_get("ssh-fossil", "fossil"); |
| 216 | } |
| 217 | if( g.zSshCmd && g.zSshCmd[0] ){ |
| 218 | db_set("ssh-command", g.zSshCmd, 0); |
| 219 | } |
| 220 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 221 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 222 | }else{ |
| 223 | g.zFossilUser = db_get("ssh-fossil-user", 0); |
| 224 | } |
| 225 | } |
| 226 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -106,11 +106,11 @@ | |
| 106 | const char *zDefaultUser; /* Optional name of the default user */ |
| 107 | int nErr = 0; |
| 108 | int bPrivate = 0; /* Also clone private branches */ |
| 109 | |
| 110 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 111 | clone_ssh_find_options(); |
| 112 | url_proxy_options(); |
| 113 | if( g.argc < 4 ){ |
| 114 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 115 | } |
| 116 | db_open_config(0); |
| @@ -158,11 +158,11 @@ | |
| 158 | "REPLACE INTO config(name,value,mtime)" |
| 159 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 160 | ); |
| 161 | url_enable_proxy(0); |
| 162 | url_get_password_if_needed(); |
| 163 | clone_ssh_db_set_options(); |
| 164 | g.xlinkClusterOnly = 1; |
| 165 | nErr = client_sync(SYNC_CLONE | bPrivate,CONFIGSET_ALL,0); |
| 166 | g.xlinkClusterOnly = 0; |
| 167 | verify_cancel(); |
| 168 | db_end_transaction(0); |
| @@ -183,11 +183,11 @@ | |
| 183 | } |
| 184 | |
| 185 | /* |
| 186 | ** Look for SSH clone command line options and setup in globals. |
| 187 | */ |
| 188 | void clone_ssh_find_options(void){ |
| 189 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 190 | const char *zSshCmd; /* SSH command string */ |
| 191 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 192 | |
| 193 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| @@ -206,20 +206,16 @@ | |
| 206 | |
| 207 | /* |
| 208 | ** Set SSH options discovered in global variables (set from command line |
| 209 | ** options). If not found, attempt to retrieve from database if present. |
| 210 | */ |
| 211 | void clone_ssh_db_set_options(void){ |
| 212 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 213 | db_set("ssh-fossil", g.zSshFossilCmd, 0); |
| 214 | } |
| 215 | if( g.zSshCmd && g.zSshCmd[0] ){ |
| 216 | db_set("ssh-command", g.zSshCmd, 0); |
| 217 | } |
| 218 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 219 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 220 | } |
| 221 | } |
| 222 |
+4
-8
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -106,11 +106,11 @@ | ||
| 106 | 106 | const char *zDefaultUser; /* Optional name of the default user */ |
| 107 | 107 | int nErr = 0; |
| 108 | 108 | int bPrivate = 0; /* Also clone private branches */ |
| 109 | 109 | |
| 110 | 110 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 111 | - clone_ssh_options(); | |
| 111 | + clone_ssh_find_options(); | |
| 112 | 112 | url_proxy_options(); |
| 113 | 113 | if( g.argc < 4 ){ |
| 114 | 114 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 115 | 115 | } |
| 116 | 116 | db_open_config(0); |
| @@ -158,11 +158,11 @@ | ||
| 158 | 158 | "REPLACE INTO config(name,value,mtime)" |
| 159 | 159 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 160 | 160 | ); |
| 161 | 161 | url_enable_proxy(0); |
| 162 | 162 | url_get_password_if_needed(); |
| 163 | - clone_ssh_db_options(); | |
| 163 | + clone_ssh_db_set_options(); | |
| 164 | 164 | g.xlinkClusterOnly = 1; |
| 165 | 165 | nErr = client_sync(SYNC_CLONE | bPrivate,CONFIGSET_ALL,0); |
| 166 | 166 | g.xlinkClusterOnly = 0; |
| 167 | 167 | verify_cancel(); |
| 168 | 168 | db_end_transaction(0); |
| @@ -183,11 +183,11 @@ | ||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /* |
| 186 | 186 | ** Look for SSH clone command line options and setup in globals. |
| 187 | 187 | */ |
| 188 | -void clone_ssh_options(void){ | |
| 188 | +void clone_ssh_find_options(void){ | |
| 189 | 189 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 190 | 190 | const char *zSshCmd; /* SSH command string */ |
| 191 | 191 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 192 | 192 | |
| 193 | 193 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| @@ -206,20 +206,16 @@ | ||
| 206 | 206 | |
| 207 | 207 | /* |
| 208 | 208 | ** Set SSH options discovered in global variables (set from command line |
| 209 | 209 | ** options). If not found, attempt to retrieve from database if present. |
| 210 | 210 | */ |
| 211 | -void clone_ssh_db_options(void){ | |
| 211 | +void clone_ssh_db_set_options(void){ | |
| 212 | 212 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 213 | 213 | db_set("ssh-fossil", g.zSshFossilCmd, 0); |
| 214 | - }else{ | |
| 215 | - g.zSshFossilCmd = db_get("ssh-fossil", "fossil"); | |
| 216 | 214 | } |
| 217 | 215 | if( g.zSshCmd && g.zSshCmd[0] ){ |
| 218 | 216 | db_set("ssh-command", g.zSshCmd, 0); |
| 219 | 217 | } |
| 220 | 218 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 221 | 219 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 222 | - }else{ | |
| 223 | - g.zFossilUser = db_get("ssh-fossil-user", 0); | |
| 224 | 220 | } |
| 225 | 221 | } |
| 226 | 222 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -106,11 +106,11 @@ | |
| 106 | const char *zDefaultUser; /* Optional name of the default user */ |
| 107 | int nErr = 0; |
| 108 | int bPrivate = 0; /* Also clone private branches */ |
| 109 | |
| 110 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 111 | clone_ssh_options(); |
| 112 | url_proxy_options(); |
| 113 | if( g.argc < 4 ){ |
| 114 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 115 | } |
| 116 | db_open_config(0); |
| @@ -158,11 +158,11 @@ | |
| 158 | "REPLACE INTO config(name,value,mtime)" |
| 159 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 160 | ); |
| 161 | url_enable_proxy(0); |
| 162 | url_get_password_if_needed(); |
| 163 | clone_ssh_db_options(); |
| 164 | g.xlinkClusterOnly = 1; |
| 165 | nErr = client_sync(SYNC_CLONE | bPrivate,CONFIGSET_ALL,0); |
| 166 | g.xlinkClusterOnly = 0; |
| 167 | verify_cancel(); |
| 168 | db_end_transaction(0); |
| @@ -183,11 +183,11 @@ | |
| 183 | } |
| 184 | |
| 185 | /* |
| 186 | ** Look for SSH clone command line options and setup in globals. |
| 187 | */ |
| 188 | void clone_ssh_options(void){ |
| 189 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 190 | const char *zSshCmd; /* SSH command string */ |
| 191 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 192 | |
| 193 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| @@ -206,20 +206,16 @@ | |
| 206 | |
| 207 | /* |
| 208 | ** Set SSH options discovered in global variables (set from command line |
| 209 | ** options). If not found, attempt to retrieve from database if present. |
| 210 | */ |
| 211 | void clone_ssh_db_options(void){ |
| 212 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 213 | db_set("ssh-fossil", g.zSshFossilCmd, 0); |
| 214 | }else{ |
| 215 | g.zSshFossilCmd = db_get("ssh-fossil", "fossil"); |
| 216 | } |
| 217 | if( g.zSshCmd && g.zSshCmd[0] ){ |
| 218 | db_set("ssh-command", g.zSshCmd, 0); |
| 219 | } |
| 220 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 221 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 222 | }else{ |
| 223 | g.zFossilUser = db_get("ssh-fossil-user", 0); |
| 224 | } |
| 225 | } |
| 226 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -106,11 +106,11 @@ | |
| 106 | const char *zDefaultUser; /* Optional name of the default user */ |
| 107 | int nErr = 0; |
| 108 | int bPrivate = 0; /* Also clone private branches */ |
| 109 | |
| 110 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 111 | clone_ssh_find_options(); |
| 112 | url_proxy_options(); |
| 113 | if( g.argc < 4 ){ |
| 114 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 115 | } |
| 116 | db_open_config(0); |
| @@ -158,11 +158,11 @@ | |
| 158 | "REPLACE INTO config(name,value,mtime)" |
| 159 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 160 | ); |
| 161 | url_enable_proxy(0); |
| 162 | url_get_password_if_needed(); |
| 163 | clone_ssh_db_set_options(); |
| 164 | g.xlinkClusterOnly = 1; |
| 165 | nErr = client_sync(SYNC_CLONE | bPrivate,CONFIGSET_ALL,0); |
| 166 | g.xlinkClusterOnly = 0; |
| 167 | verify_cancel(); |
| 168 | db_end_transaction(0); |
| @@ -183,11 +183,11 @@ | |
| 183 | } |
| 184 | |
| 185 | /* |
| 186 | ** Look for SSH clone command line options and setup in globals. |
| 187 | */ |
| 188 | void clone_ssh_find_options(void){ |
| 189 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 190 | const char *zSshCmd; /* SSH command string */ |
| 191 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 192 | |
| 193 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| @@ -206,20 +206,16 @@ | |
| 206 | |
| 207 | /* |
| 208 | ** Set SSH options discovered in global variables (set from command line |
| 209 | ** options). If not found, attempt to retrieve from database if present. |
| 210 | */ |
| 211 | void clone_ssh_db_set_options(void){ |
| 212 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 213 | db_set("ssh-fossil", g.zSshFossilCmd, 0); |
| 214 | } |
| 215 | if( g.zSshCmd && g.zSshCmd[0] ){ |
| 216 | db_set("ssh-command", g.zSshCmd, 0); |
| 217 | } |
| 218 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 219 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 220 | } |
| 221 | } |
| 222 |
+13
-9
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -105,46 +105,50 @@ | ||
| 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 */ | |
| 111 | + const char *zSshFossilCmd; /* Path to fossil on remote host */ | |
| 110 | 112 | const char *zSsh; /* The base SSH command */ |
| 111 | 113 | Blob zCmd; /* The SSH command */ |
| 112 | 114 | char *zHost; /* The host name to contact */ |
| 113 | 115 | int n; /* Size of prefix string */ |
| 114 | 116 | |
| 115 | 117 | zSsh = db_get("ssh-command", zDefaultSshCmd); |
| 118 | + zSshFossilCmd = db_get("ssh-fossil", "fossil"); | |
| 116 | 119 | blob_init(&zCmd, zSsh, -1); |
| 117 | 120 | if( g.urlPort!=g.urlDfltPort && g.urlPort ){ |
| 118 | 121 | #ifdef __MINGW32__ |
| 119 | 122 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 120 | 123 | #else |
| 121 | 124 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 122 | 125 | #endif |
| 123 | 126 | } |
| 124 | - fossil_force_newline(); | |
| 125 | - fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 127 | + if( fPrintSshCmd ){ | |
| 128 | + fossil_force_newline(); | |
| 129 | + fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 130 | + } | |
| 126 | 131 | if( g.urlUser && g.urlUser[0] ){ |
| 127 | 132 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 128 | 133 | }else{ |
| 129 | 134 | zHost = mprintf("%s", g.urlName); |
| 130 | 135 | } |
| 131 | 136 | n = blob_size(&zCmd); |
| 132 | 137 | blob_append(&zCmd, " ", 1); |
| 133 | 138 | shell_escape(&zCmd, zHost); |
| 134 | - if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ | |
| 135 | - blob_append(&zCmd, " ", 1); | |
| 136 | - shell_escape(&zCmd, mprintf("%s", g.zSshFossilCmd)); | |
| 137 | - }else{ | |
| 138 | - blob_append(&zCmd, " fossil", 7); | |
| 139 | - } | |
| 139 | + blob_append(&zCmd, " ", 1); | |
| 140 | + shell_escape(&zCmd, mprintf("%s", zSshFossilCmd)); | |
| 140 | 141 | blob_append(&zCmd, " http", 5); |
| 141 | 142 | if( g.urlPath && g.urlPath[0] ){ |
| 142 | 143 | blob_append(&zCmd, " ", 1); |
| 143 | 144 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 144 | 145 | } |
| 145 | - fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ | |
| 146 | + if( fPrintSshCmd ){ | |
| 147 | + fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ | |
| 148 | + fPrintSshCmd = 0; | |
| 149 | + } | |
| 146 | 150 | free(zHost); |
| 147 | 151 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 148 | 152 | if( sshPid==0 ){ |
| 149 | 153 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 150 | 154 | } |
| 151 | 155 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -105,46 +105,50 @@ | |
| 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 | |
| 115 | zSsh = db_get("ssh-command", zDefaultSshCmd); |
| 116 | blob_init(&zCmd, zSsh, -1); |
| 117 | if( g.urlPort!=g.urlDfltPort && g.urlPort ){ |
| 118 | #ifdef __MINGW32__ |
| 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 | }else{ |
| 129 | zHost = mprintf("%s", g.urlName); |
| 130 | } |
| 131 | n = blob_size(&zCmd); |
| 132 | blob_append(&zCmd, " ", 1); |
| 133 | shell_escape(&zCmd, zHost); |
| 134 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 135 | blob_append(&zCmd, " ", 1); |
| 136 | shell_escape(&zCmd, mprintf("%s", g.zSshFossilCmd)); |
| 137 | }else{ |
| 138 | blob_append(&zCmd, " fossil", 7); |
| 139 | } |
| 140 | blob_append(&zCmd, " http", 5); |
| 141 | if( g.urlPath && g.urlPath[0] ){ |
| 142 | blob_append(&zCmd, " ", 1); |
| 143 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 144 | } |
| 145 | fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ |
| 146 | free(zHost); |
| 147 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 148 | if( sshPid==0 ){ |
| 149 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 150 | } |
| 151 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -105,46 +105,50 @@ | |
| 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 *zSshFossilCmd; /* Path to fossil on remote host */ |
| 112 | const char *zSsh; /* The base SSH command */ |
| 113 | Blob zCmd; /* The SSH command */ |
| 114 | char *zHost; /* The host name to contact */ |
| 115 | int n; /* Size of prefix string */ |
| 116 | |
| 117 | zSsh = db_get("ssh-command", zDefaultSshCmd); |
| 118 | zSshFossilCmd = db_get("ssh-fossil", "fossil"); |
| 119 | blob_init(&zCmd, zSsh, -1); |
| 120 | if( g.urlPort!=g.urlDfltPort && g.urlPort ){ |
| 121 | #ifdef __MINGW32__ |
| 122 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 123 | #else |
| 124 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 125 | #endif |
| 126 | } |
| 127 | if( fPrintSshCmd ){ |
| 128 | fossil_force_newline(); |
| 129 | fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ |
| 130 | } |
| 131 | if( g.urlUser && g.urlUser[0] ){ |
| 132 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 133 | }else{ |
| 134 | zHost = mprintf("%s", g.urlName); |
| 135 | } |
| 136 | n = blob_size(&zCmd); |
| 137 | blob_append(&zCmd, " ", 1); |
| 138 | shell_escape(&zCmd, zHost); |
| 139 | blob_append(&zCmd, " ", 1); |
| 140 | shell_escape(&zCmd, mprintf("%s", zSshFossilCmd)); |
| 141 | blob_append(&zCmd, " http", 5); |
| 142 | if( g.urlPath && g.urlPath[0] ){ |
| 143 | blob_append(&zCmd, " ", 1); |
| 144 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 145 | } |
| 146 | if( fPrintSshCmd ){ |
| 147 | fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ |
| 148 | fPrintSshCmd = 0; |
| 149 | } |
| 150 | free(zHost); |
| 151 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 152 | if( sshPid==0 ){ |
| 153 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 154 | } |
| 155 |
+13
-9
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -105,46 +105,50 @@ | ||
| 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 */ | |
| 111 | + const char *zSshFossilCmd; /* Path to fossil on remote host */ | |
| 110 | 112 | const char *zSsh; /* The base SSH command */ |
| 111 | 113 | Blob zCmd; /* The SSH command */ |
| 112 | 114 | char *zHost; /* The host name to contact */ |
| 113 | 115 | int n; /* Size of prefix string */ |
| 114 | 116 | |
| 115 | 117 | zSsh = db_get("ssh-command", zDefaultSshCmd); |
| 118 | + zSshFossilCmd = db_get("ssh-fossil", "fossil"); | |
| 116 | 119 | blob_init(&zCmd, zSsh, -1); |
| 117 | 120 | if( g.urlPort!=g.urlDfltPort && g.urlPort ){ |
| 118 | 121 | #ifdef __MINGW32__ |
| 119 | 122 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 120 | 123 | #else |
| 121 | 124 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 122 | 125 | #endif |
| 123 | 126 | } |
| 124 | - fossil_force_newline(); | |
| 125 | - fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 127 | + if( fPrintSshCmd ){ | |
| 128 | + fossil_force_newline(); | |
| 129 | + fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 130 | + } | |
| 126 | 131 | if( g.urlUser && g.urlUser[0] ){ |
| 127 | 132 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 128 | 133 | }else{ |
| 129 | 134 | zHost = mprintf("%s", g.urlName); |
| 130 | 135 | } |
| 131 | 136 | n = blob_size(&zCmd); |
| 132 | 137 | blob_append(&zCmd, " ", 1); |
| 133 | 138 | shell_escape(&zCmd, zHost); |
| 134 | - if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ | |
| 135 | - blob_append(&zCmd, " ", 1); | |
| 136 | - shell_escape(&zCmd, mprintf("%s", g.zSshFossilCmd)); | |
| 137 | - }else{ | |
| 138 | - blob_append(&zCmd, " fossil", 7); | |
| 139 | - } | |
| 139 | + blob_append(&zCmd, " ", 1); | |
| 140 | + shell_escape(&zCmd, mprintf("%s", zSshFossilCmd)); | |
| 140 | 141 | blob_append(&zCmd, " http", 5); |
| 141 | 142 | if( g.urlPath && g.urlPath[0] ){ |
| 142 | 143 | blob_append(&zCmd, " ", 1); |
| 143 | 144 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 144 | 145 | } |
| 145 | - fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ | |
| 146 | + if( fPrintSshCmd ){ | |
| 147 | + fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ | |
| 148 | + fPrintSshCmd = 0; | |
| 149 | + } | |
| 146 | 150 | free(zHost); |
| 147 | 151 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 148 | 152 | if( sshPid==0 ){ |
| 149 | 153 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 150 | 154 | } |
| 151 | 155 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -105,46 +105,50 @@ | |
| 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 | |
| 115 | zSsh = db_get("ssh-command", zDefaultSshCmd); |
| 116 | blob_init(&zCmd, zSsh, -1); |
| 117 | if( g.urlPort!=g.urlDfltPort && g.urlPort ){ |
| 118 | #ifdef __MINGW32__ |
| 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 | }else{ |
| 129 | zHost = mprintf("%s", g.urlName); |
| 130 | } |
| 131 | n = blob_size(&zCmd); |
| 132 | blob_append(&zCmd, " ", 1); |
| 133 | shell_escape(&zCmd, zHost); |
| 134 | if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){ |
| 135 | blob_append(&zCmd, " ", 1); |
| 136 | shell_escape(&zCmd, mprintf("%s", g.zSshFossilCmd)); |
| 137 | }else{ |
| 138 | blob_append(&zCmd, " fossil", 7); |
| 139 | } |
| 140 | blob_append(&zCmd, " http", 5); |
| 141 | if( g.urlPath && g.urlPath[0] ){ |
| 142 | blob_append(&zCmd, " ", 1); |
| 143 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 144 | } |
| 145 | fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ |
| 146 | free(zHost); |
| 147 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 148 | if( sshPid==0 ){ |
| 149 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 150 | } |
| 151 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -105,46 +105,50 @@ | |
| 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 *zSshFossilCmd; /* Path to fossil on remote host */ |
| 112 | const char *zSsh; /* The base SSH command */ |
| 113 | Blob zCmd; /* The SSH command */ |
| 114 | char *zHost; /* The host name to contact */ |
| 115 | int n; /* Size of prefix string */ |
| 116 | |
| 117 | zSsh = db_get("ssh-command", zDefaultSshCmd); |
| 118 | zSshFossilCmd = db_get("ssh-fossil", "fossil"); |
| 119 | blob_init(&zCmd, zSsh, -1); |
| 120 | if( g.urlPort!=g.urlDfltPort && g.urlPort ){ |
| 121 | #ifdef __MINGW32__ |
| 122 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 123 | #else |
| 124 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 125 | #endif |
| 126 | } |
| 127 | if( fPrintSshCmd ){ |
| 128 | fossil_force_newline(); |
| 129 | fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ |
| 130 | } |
| 131 | if( g.urlUser && g.urlUser[0] ){ |
| 132 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 133 | }else{ |
| 134 | zHost = mprintf("%s", g.urlName); |
| 135 | } |
| 136 | n = blob_size(&zCmd); |
| 137 | blob_append(&zCmd, " ", 1); |
| 138 | shell_escape(&zCmd, zHost); |
| 139 | blob_append(&zCmd, " ", 1); |
| 140 | shell_escape(&zCmd, mprintf("%s", zSshFossilCmd)); |
| 141 | blob_append(&zCmd, " http", 5); |
| 142 | if( g.urlPath && g.urlPath[0] ){ |
| 143 | blob_append(&zCmd, " ", 1); |
| 144 | shell_escape(&zCmd, mprintf("%s", g.urlPath)); |
| 145 | } |
| 146 | if( fPrintSshCmd ){ |
| 147 | fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ |
| 148 | fPrintSshCmd = 0; |
| 149 | } |
| 150 | free(zHost); |
| 151 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 152 | if( sshPid==0 ){ |
| 153 | socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); |
| 154 | } |
| 155 |
+2
-4
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -48,13 +48,10 @@ | ||
| 48 | 48 | } |
| 49 | 49 | }else{ |
| 50 | 50 | /* Autosync defaults on. To make it default off, "return" here. */ |
| 51 | 51 | } |
| 52 | 52 | url_parse(0, URL_REMEMBER); |
| 53 | - if( g.urlIsSsh ){ | |
| 54 | - clone_ssh_db_options(); | |
| 55 | - } | |
| 56 | 53 | if( g.urlProtocol==0 ) return 0; |
| 57 | 54 | if( ( g.urlUser!=0 || g.zFossilUser!=0 ) && g.urlPasswd==0 ){ |
| 58 | 55 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 59 | 56 | } |
| 60 | 57 | if( g.urlIsSsh && g.urlPasswd==0 ){ |
| @@ -104,18 +101,19 @@ | ||
| 104 | 101 | } |
| 105 | 102 | if( find_option("verbose","v",0)!=0 ){ |
| 106 | 103 | *pSyncFlags |= SYNC_VERBOSE; |
| 107 | 104 | } |
| 108 | 105 | url_proxy_options(); |
| 106 | + clone_ssh_find_options(); | |
| 109 | 107 | db_find_and_open_repository(0, 0); |
| 110 | 108 | db_open_config(0); |
| 111 | 109 | if( g.argc==2 ){ |
| 112 | 110 | if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; |
| 113 | 111 | }else if( g.argc==3 ){ |
| 114 | 112 | zUrl = g.argv[2]; |
| 115 | 113 | } |
| 116 | - clone_ssh_db_options(); | |
| 114 | + clone_ssh_db_set_options(); | |
| 117 | 115 | url_parse(zUrl, urlFlags); |
| 118 | 116 | if( g.urlProtocol==0 ){ |
| 119 | 117 | if( urlOptional ) fossil_exit(0); |
| 120 | 118 | usage("URL"); |
| 121 | 119 | } |
| 122 | 120 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -48,13 +48,10 @@ | |
| 48 | } |
| 49 | }else{ |
| 50 | /* Autosync defaults on. To make it default off, "return" here. */ |
| 51 | } |
| 52 | url_parse(0, URL_REMEMBER); |
| 53 | if( g.urlIsSsh ){ |
| 54 | clone_ssh_db_options(); |
| 55 | } |
| 56 | if( g.urlProtocol==0 ) return 0; |
| 57 | if( ( g.urlUser!=0 || g.zFossilUser!=0 ) && g.urlPasswd==0 ){ |
| 58 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 59 | } |
| 60 | if( g.urlIsSsh && g.urlPasswd==0 ){ |
| @@ -104,18 +101,19 @@ | |
| 104 | } |
| 105 | if( find_option("verbose","v",0)!=0 ){ |
| 106 | *pSyncFlags |= SYNC_VERBOSE; |
| 107 | } |
| 108 | url_proxy_options(); |
| 109 | db_find_and_open_repository(0, 0); |
| 110 | db_open_config(0); |
| 111 | if( g.argc==2 ){ |
| 112 | if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; |
| 113 | }else if( g.argc==3 ){ |
| 114 | zUrl = g.argv[2]; |
| 115 | } |
| 116 | clone_ssh_db_options(); |
| 117 | url_parse(zUrl, urlFlags); |
| 118 | if( g.urlProtocol==0 ){ |
| 119 | if( urlOptional ) fossil_exit(0); |
| 120 | usage("URL"); |
| 121 | } |
| 122 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -48,13 +48,10 @@ | |
| 48 | } |
| 49 | }else{ |
| 50 | /* Autosync defaults on. To make it default off, "return" here. */ |
| 51 | } |
| 52 | url_parse(0, URL_REMEMBER); |
| 53 | if( g.urlProtocol==0 ) return 0; |
| 54 | if( ( g.urlUser!=0 || g.zFossilUser!=0 ) && g.urlPasswd==0 ){ |
| 55 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 56 | } |
| 57 | if( g.urlIsSsh && g.urlPasswd==0 ){ |
| @@ -104,18 +101,19 @@ | |
| 101 | } |
| 102 | if( find_option("verbose","v",0)!=0 ){ |
| 103 | *pSyncFlags |= SYNC_VERBOSE; |
| 104 | } |
| 105 | url_proxy_options(); |
| 106 | clone_ssh_find_options(); |
| 107 | db_find_and_open_repository(0, 0); |
| 108 | db_open_config(0); |
| 109 | if( g.argc==2 ){ |
| 110 | if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; |
| 111 | }else if( g.argc==3 ){ |
| 112 | zUrl = g.argv[2]; |
| 113 | } |
| 114 | clone_ssh_db_set_options(); |
| 115 | url_parse(zUrl, urlFlags); |
| 116 | if( g.urlProtocol==0 ){ |
| 117 | if( urlOptional ) fossil_exit(0); |
| 118 | usage("URL"); |
| 119 | } |
| 120 |
+2
-4
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -48,13 +48,10 @@ | ||
| 48 | 48 | } |
| 49 | 49 | }else{ |
| 50 | 50 | /* Autosync defaults on. To make it default off, "return" here. */ |
| 51 | 51 | } |
| 52 | 52 | url_parse(0, URL_REMEMBER); |
| 53 | - if( g.urlIsSsh ){ | |
| 54 | - clone_ssh_db_options(); | |
| 55 | - } | |
| 56 | 53 | if( g.urlProtocol==0 ) return 0; |
| 57 | 54 | if( ( g.urlUser!=0 || g.zFossilUser!=0 ) && g.urlPasswd==0 ){ |
| 58 | 55 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 59 | 56 | } |
| 60 | 57 | if( g.urlIsSsh && g.urlPasswd==0 ){ |
| @@ -104,18 +101,19 @@ | ||
| 104 | 101 | } |
| 105 | 102 | if( find_option("verbose","v",0)!=0 ){ |
| 106 | 103 | *pSyncFlags |= SYNC_VERBOSE; |
| 107 | 104 | } |
| 108 | 105 | url_proxy_options(); |
| 106 | + clone_ssh_find_options(); | |
| 109 | 107 | db_find_and_open_repository(0, 0); |
| 110 | 108 | db_open_config(0); |
| 111 | 109 | if( g.argc==2 ){ |
| 112 | 110 | if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; |
| 113 | 111 | }else if( g.argc==3 ){ |
| 114 | 112 | zUrl = g.argv[2]; |
| 115 | 113 | } |
| 116 | - clone_ssh_db_options(); | |
| 114 | + clone_ssh_db_set_options(); | |
| 117 | 115 | url_parse(zUrl, urlFlags); |
| 118 | 116 | if( g.urlProtocol==0 ){ |
| 119 | 117 | if( urlOptional ) fossil_exit(0); |
| 120 | 118 | usage("URL"); |
| 121 | 119 | } |
| 122 | 120 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -48,13 +48,10 @@ | |
| 48 | } |
| 49 | }else{ |
| 50 | /* Autosync defaults on. To make it default off, "return" here. */ |
| 51 | } |
| 52 | url_parse(0, URL_REMEMBER); |
| 53 | if( g.urlIsSsh ){ |
| 54 | clone_ssh_db_options(); |
| 55 | } |
| 56 | if( g.urlProtocol==0 ) return 0; |
| 57 | if( ( g.urlUser!=0 || g.zFossilUser!=0 ) && g.urlPasswd==0 ){ |
| 58 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 59 | } |
| 60 | if( g.urlIsSsh && g.urlPasswd==0 ){ |
| @@ -104,18 +101,19 @@ | |
| 104 | } |
| 105 | if( find_option("verbose","v",0)!=0 ){ |
| 106 | *pSyncFlags |= SYNC_VERBOSE; |
| 107 | } |
| 108 | url_proxy_options(); |
| 109 | db_find_and_open_repository(0, 0); |
| 110 | db_open_config(0); |
| 111 | if( g.argc==2 ){ |
| 112 | if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; |
| 113 | }else if( g.argc==3 ){ |
| 114 | zUrl = g.argv[2]; |
| 115 | } |
| 116 | clone_ssh_db_options(); |
| 117 | url_parse(zUrl, urlFlags); |
| 118 | if( g.urlProtocol==0 ){ |
| 119 | if( urlOptional ) fossil_exit(0); |
| 120 | usage("URL"); |
| 121 | } |
| 122 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -48,13 +48,10 @@ | |
| 48 | } |
| 49 | }else{ |
| 50 | /* Autosync defaults on. To make it default off, "return" here. */ |
| 51 | } |
| 52 | url_parse(0, URL_REMEMBER); |
| 53 | if( g.urlProtocol==0 ) return 0; |
| 54 | if( ( g.urlUser!=0 || g.zFossilUser!=0 ) && g.urlPasswd==0 ){ |
| 55 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 56 | } |
| 57 | if( g.urlIsSsh && g.urlPasswd==0 ){ |
| @@ -104,18 +101,19 @@ | |
| 101 | } |
| 102 | if( find_option("verbose","v",0)!=0 ){ |
| 103 | *pSyncFlags |= SYNC_VERBOSE; |
| 104 | } |
| 105 | url_proxy_options(); |
| 106 | clone_ssh_find_options(); |
| 107 | db_find_and_open_repository(0, 0); |
| 108 | db_open_config(0); |
| 109 | if( g.argc==2 ){ |
| 110 | if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; |
| 111 | }else if( g.argc==3 ){ |
| 112 | zUrl = g.argv[2]; |
| 113 | } |
| 114 | clone_ssh_db_set_options(); |
| 115 | url_parse(zUrl, urlFlags); |
| 116 | if( g.urlProtocol==0 ){ |
| 117 | if( urlOptional ) fossil_exit(0); |
| 118 | usage("URL"); |
| 119 | } |
| 120 |
+4
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -77,10 +77,11 @@ | ||
| 77 | 77 | |
| 78 | 78 | if( zUrl==0 ){ |
| 79 | 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | 80 | if( zUrl==0 ) return; |
| 81 | 81 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 82 | + g.zFossilUser = db_get("ssh-fossil-user", 0); | |
| 82 | 83 | bSetUrl = 0; |
| 83 | 84 | } |
| 84 | 85 | |
| 85 | 86 | if( strncmp(zUrl, "http://", 7)==0 |
| 86 | 87 | || strncmp(zUrl, "https://", 8)==0 |
| @@ -187,10 +188,13 @@ | ||
| 187 | 188 | } |
| 188 | 189 | }else{ |
| 189 | 190 | fossil_fatal("unknown repository: %s", zUrl); |
| 190 | 191 | } |
| 191 | 192 | g.urlFlags = urlFlags; |
| 193 | + if( g.urlIsSsh ){ | |
| 194 | + g.zFossilUser = db_get("ssh-fossil-user", 0); | |
| 195 | + } | |
| 192 | 196 | if( g.urlIsFile ){ |
| 193 | 197 | Blob cfile; |
| 194 | 198 | dehttpize(zFile); |
| 195 | 199 | file_canonical_name(zFile, &cfile, 0); |
| 196 | 200 | free(zFile); |
| 197 | 201 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -77,10 +77,11 @@ | |
| 77 | |
| 78 | if( zUrl==0 ){ |
| 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | if( zUrl==0 ) return; |
| 81 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 82 | bSetUrl = 0; |
| 83 | } |
| 84 | |
| 85 | if( strncmp(zUrl, "http://", 7)==0 |
| 86 | || strncmp(zUrl, "https://", 8)==0 |
| @@ -187,10 +188,13 @@ | |
| 187 | } |
| 188 | }else{ |
| 189 | fossil_fatal("unknown repository: %s", zUrl); |
| 190 | } |
| 191 | g.urlFlags = urlFlags; |
| 192 | if( g.urlIsFile ){ |
| 193 | Blob cfile; |
| 194 | dehttpize(zFile); |
| 195 | file_canonical_name(zFile, &cfile, 0); |
| 196 | free(zFile); |
| 197 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -77,10 +77,11 @@ | |
| 77 | |
| 78 | if( zUrl==0 ){ |
| 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | if( zUrl==0 ) return; |
| 81 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 82 | g.zFossilUser = db_get("ssh-fossil-user", 0); |
| 83 | bSetUrl = 0; |
| 84 | } |
| 85 | |
| 86 | if( strncmp(zUrl, "http://", 7)==0 |
| 87 | || strncmp(zUrl, "https://", 8)==0 |
| @@ -187,10 +188,13 @@ | |
| 188 | } |
| 189 | }else{ |
| 190 | fossil_fatal("unknown repository: %s", zUrl); |
| 191 | } |
| 192 | g.urlFlags = urlFlags; |
| 193 | if( g.urlIsSsh ){ |
| 194 | g.zFossilUser = db_get("ssh-fossil-user", 0); |
| 195 | } |
| 196 | if( g.urlIsFile ){ |
| 197 | Blob cfile; |
| 198 | dehttpize(zFile); |
| 199 | file_canonical_name(zFile, &cfile, 0); |
| 200 | free(zFile); |
| 201 |
+4
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -77,10 +77,11 @@ | ||
| 77 | 77 | |
| 78 | 78 | if( zUrl==0 ){ |
| 79 | 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | 80 | if( zUrl==0 ) return; |
| 81 | 81 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 82 | + g.zFossilUser = db_get("ssh-fossil-user", 0); | |
| 82 | 83 | bSetUrl = 0; |
| 83 | 84 | } |
| 84 | 85 | |
| 85 | 86 | if( strncmp(zUrl, "http://", 7)==0 |
| 86 | 87 | || strncmp(zUrl, "https://", 8)==0 |
| @@ -187,10 +188,13 @@ | ||
| 187 | 188 | } |
| 188 | 189 | }else{ |
| 189 | 190 | fossil_fatal("unknown repository: %s", zUrl); |
| 190 | 191 | } |
| 191 | 192 | g.urlFlags = urlFlags; |
| 193 | + if( g.urlIsSsh ){ | |
| 194 | + g.zFossilUser = db_get("ssh-fossil-user", 0); | |
| 195 | + } | |
| 192 | 196 | if( g.urlIsFile ){ |
| 193 | 197 | Blob cfile; |
| 194 | 198 | dehttpize(zFile); |
| 195 | 199 | file_canonical_name(zFile, &cfile, 0); |
| 196 | 200 | free(zFile); |
| 197 | 201 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -77,10 +77,11 @@ | |
| 77 | |
| 78 | if( zUrl==0 ){ |
| 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | if( zUrl==0 ) return; |
| 81 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 82 | bSetUrl = 0; |
| 83 | } |
| 84 | |
| 85 | if( strncmp(zUrl, "http://", 7)==0 |
| 86 | || strncmp(zUrl, "https://", 8)==0 |
| @@ -187,10 +188,13 @@ | |
| 187 | } |
| 188 | }else{ |
| 189 | fossil_fatal("unknown repository: %s", zUrl); |
| 190 | } |
| 191 | g.urlFlags = urlFlags; |
| 192 | if( g.urlIsFile ){ |
| 193 | Blob cfile; |
| 194 | dehttpize(zFile); |
| 195 | file_canonical_name(zFile, &cfile, 0); |
| 196 | free(zFile); |
| 197 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -77,10 +77,11 @@ | |
| 77 | |
| 78 | if( zUrl==0 ){ |
| 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | if( zUrl==0 ) return; |
| 81 | g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); |
| 82 | g.zFossilUser = db_get("ssh-fossil-user", 0); |
| 83 | bSetUrl = 0; |
| 84 | } |
| 85 | |
| 86 | if( strncmp(zUrl, "http://", 7)==0 |
| 87 | || strncmp(zUrl, "https://", 8)==0 |
| @@ -187,10 +188,13 @@ | |
| 188 | } |
| 189 | }else{ |
| 190 | fossil_fatal("unknown repository: %s", zUrl); |
| 191 | } |
| 192 | g.urlFlags = urlFlags; |
| 193 | if( g.urlIsSsh ){ |
| 194 | g.zFossilUser = db_get("ssh-fossil-user", 0); |
| 195 | } |
| 196 | if( g.urlIsFile ){ |
| 197 | Blob cfile; |
| 198 | dehttpize(zFile); |
| 199 | file_canonical_name(zFile, &cfile, 0); |
| 200 | free(zFile); |
| 201 |