Fossil SCM
Make it possible to override global setting from command line. Improve sync output when test-http is in use.
Commit
3c479fb95bc006a77c5eb62b4c8b04cd2339984b
Parent
738b505362ffec8…
5 files changed
+8
-4
+1
-1
+2
-2
+4
-4
+5
-3
+8
-4
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -96,11 +96,11 @@ | ||
| 96 | 96 | ** --private Also clone private branches |
| 97 | 97 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 98 | 98 | ** --ssh-fossil|-f /fossil Use this path as remote fossil command |
| 99 | 99 | ** --ssh-command|-c 'command' Use this SSH command |
| 100 | 100 | ** --ssh-fossil-user|-l user Fossil user to use for SSH if different. |
| 101 | -** --ssh-use-http|-h Enable http instead of test-http | |
| 101 | +** --ssh-use-http|-h on/off Enable http instead of test-http. Default: off | |
| 102 | 102 | ** |
| 103 | 103 | ** See also: init |
| 104 | 104 | */ |
| 105 | 105 | void clone_cmd(void){ |
| 106 | 106 | char *zPassword; |
| @@ -188,10 +188,11 @@ | ||
| 188 | 188 | */ |
| 189 | 189 | void clone_ssh_find_options(void){ |
| 190 | 190 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 191 | 191 | const char *zSshCmd; /* SSH command string */ |
| 192 | 192 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 193 | + const char *zSshUseHttp; /* Use http or test-http mode for SSH */ | |
| 193 | 194 | |
| 194 | 195 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| 195 | 196 | if( zSshFossilCmd && zSshFossilCmd[0] ){ |
| 196 | 197 | g.zSshFossilCmd = mprintf("%s", zSshFossilCmd); |
| 197 | 198 | } |
| @@ -201,11 +202,14 @@ | ||
| 201 | 202 | } |
| 202 | 203 | zFossilUser = find_option("ssh-fossil-user","l",1); |
| 203 | 204 | if( zFossilUser && zFossilUser[0] ){ |
| 204 | 205 | g.zFossilUser = mprintf("%s", zFossilUser); |
| 205 | 206 | } |
| 206 | - g.fSshUseHttp = find_option("ssh-use-http","h",0)!=0; | |
| 207 | + zSshUseHttp = find_option("ssh-use-http","h",1); | |
| 208 | + if( zSshUseHttp && zSshUseHttp[0] ){ | |
| 209 | + g.zSshUseHttp = mprintf("%s", zSshUseHttp); | |
| 210 | + } | |
| 207 | 211 | } |
| 208 | 212 | |
| 209 | 213 | /* |
| 210 | 214 | ** Set SSH options discovered in global variables (set from command line |
| 211 | 215 | ** options). |
| @@ -218,9 +222,9 @@ | ||
| 218 | 222 | db_set("ssh-command", g.zSshCmd, 0); |
| 219 | 223 | } |
| 220 | 224 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 221 | 225 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 222 | 226 | } |
| 223 | - if( g.fSshUseHttp ){ | |
| 224 | - db_set_int("ssh-use-http", 1, 0); | |
| 227 | + if( g.zSshUseHttp && g.zSshUseHttp[0] ){ | |
| 228 | + db_set_int("ssh-use-http", is_truth(g.zSshUseHttp), 0); | |
| 225 | 229 | } |
| 226 | 230 | } |
| 227 | 231 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -96,11 +96,11 @@ | |
| 96 | ** --private Also clone private branches |
| 97 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 98 | ** --ssh-fossil|-f /fossil Use this path as remote fossil command |
| 99 | ** --ssh-command|-c 'command' Use this SSH command |
| 100 | ** --ssh-fossil-user|-l user Fossil user to use for SSH if different. |
| 101 | ** --ssh-use-http|-h Enable http instead of test-http |
| 102 | ** |
| 103 | ** See also: init |
| 104 | */ |
| 105 | void clone_cmd(void){ |
| 106 | char *zPassword; |
| @@ -188,10 +188,11 @@ | |
| 188 | */ |
| 189 | void clone_ssh_find_options(void){ |
| 190 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 191 | const char *zSshCmd; /* SSH command string */ |
| 192 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 193 | |
| 194 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| 195 | if( zSshFossilCmd && zSshFossilCmd[0] ){ |
| 196 | g.zSshFossilCmd = mprintf("%s", zSshFossilCmd); |
| 197 | } |
| @@ -201,11 +202,14 @@ | |
| 201 | } |
| 202 | zFossilUser = find_option("ssh-fossil-user","l",1); |
| 203 | if( zFossilUser && zFossilUser[0] ){ |
| 204 | g.zFossilUser = mprintf("%s", zFossilUser); |
| 205 | } |
| 206 | g.fSshUseHttp = find_option("ssh-use-http","h",0)!=0; |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | ** Set SSH options discovered in global variables (set from command line |
| 211 | ** options). |
| @@ -218,9 +222,9 @@ | |
| 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 | } |
| 223 | if( g.fSshUseHttp ){ |
| 224 | db_set_int("ssh-use-http", 1, 0); |
| 225 | } |
| 226 | } |
| 227 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -96,11 +96,11 @@ | |
| 96 | ** --private Also clone private branches |
| 97 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 98 | ** --ssh-fossil|-f /fossil Use this path as remote fossil command |
| 99 | ** --ssh-command|-c 'command' Use this SSH command |
| 100 | ** --ssh-fossil-user|-l user Fossil user to use for SSH if different. |
| 101 | ** --ssh-use-http|-h on/off Enable http instead of test-http. Default: off |
| 102 | ** |
| 103 | ** See also: init |
| 104 | */ |
| 105 | void clone_cmd(void){ |
| 106 | char *zPassword; |
| @@ -188,10 +188,11 @@ | |
| 188 | */ |
| 189 | void clone_ssh_find_options(void){ |
| 190 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 191 | const char *zSshCmd; /* SSH command string */ |
| 192 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 193 | const char *zSshUseHttp; /* Use http or test-http mode for SSH */ |
| 194 | |
| 195 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| 196 | if( zSshFossilCmd && zSshFossilCmd[0] ){ |
| 197 | g.zSshFossilCmd = mprintf("%s", zSshFossilCmd); |
| 198 | } |
| @@ -201,11 +202,14 @@ | |
| 202 | } |
| 203 | zFossilUser = find_option("ssh-fossil-user","l",1); |
| 204 | if( zFossilUser && zFossilUser[0] ){ |
| 205 | g.zFossilUser = mprintf("%s", zFossilUser); |
| 206 | } |
| 207 | zSshUseHttp = find_option("ssh-use-http","h",1); |
| 208 | if( zSshUseHttp && zSshUseHttp[0] ){ |
| 209 | g.zSshUseHttp = mprintf("%s", zSshUseHttp); |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /* |
| 214 | ** Set SSH options discovered in global variables (set from command line |
| 215 | ** options). |
| @@ -218,9 +222,9 @@ | |
| 222 | db_set("ssh-command", g.zSshCmd, 0); |
| 223 | } |
| 224 | if( g.zFossilUser && g.zFossilUser[0] ){ |
| 225 | db_set("ssh-fossil-user", g.zFossilUser, 0); |
| 226 | } |
| 227 | if( g.zSshUseHttp && g.zSshUseHttp[0] ){ |
| 228 | db_set_int("ssh-use-http", is_truth(g.zSshUseHttp), 0); |
| 229 | } |
| 230 | } |
| 231 |
+1
-1
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -41,11 +41,11 @@ | ||
| 41 | 41 | Blob sig; /* The signature field */ |
| 42 | 42 | |
| 43 | 43 | zLogin = url_or_fossil_user(); |
| 44 | 44 | blob_zero(pLogin); |
| 45 | 45 | if( zLogin==0 || fossil_strcmp(g.urlUser, "anonymous")==0 || |
| 46 | - ( g.urlIsSsh && url_ssh_use_http()==0 ) ){ | |
| 46 | + ( g.urlIsSsh && ! url_ssh_use_http() ) ){ | |
| 47 | 47 | return; /* If no login card for users "nobody" and "anonymous" */ |
| 48 | 48 | } |
| 49 | 49 | blob_zero(&nonce); |
| 50 | 50 | blob_zero(&pw); |
| 51 | 51 | sha1sum_blob(pPayload, &nonce); |
| 52 | 52 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | Blob sig; /* The signature field */ |
| 42 | |
| 43 | zLogin = url_or_fossil_user(); |
| 44 | blob_zero(pLogin); |
| 45 | if( zLogin==0 || fossil_strcmp(g.urlUser, "anonymous")==0 || |
| 46 | ( g.urlIsSsh && url_ssh_use_http()==0 ) ){ |
| 47 | return; /* If no login card for users "nobody" and "anonymous" */ |
| 48 | } |
| 49 | blob_zero(&nonce); |
| 50 | blob_zero(&pw); |
| 51 | sha1sum_blob(pPayload, &nonce); |
| 52 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | Blob sig; /* The signature field */ |
| 42 | |
| 43 | zLogin = url_or_fossil_user(); |
| 44 | blob_zero(pLogin); |
| 45 | if( zLogin==0 || fossil_strcmp(g.urlUser, "anonymous")==0 || |
| 46 | ( g.urlIsSsh && ! url_ssh_use_http() ) ){ |
| 47 | return; /* If no login card for users "nobody" and "anonymous" */ |
| 48 | } |
| 49 | blob_zero(&nonce); |
| 50 | blob_zero(&pw); |
| 51 | sha1sum_blob(pPayload, &nonce); |
| 52 |
+2
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -134,11 +134,11 @@ | ||
| 134 | 134 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 135 | 135 | int fQuiet; /* True if -quiet flag is present */ |
| 136 | 136 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 137 | 137 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 138 | 138 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 139 | - int fSshUseHttp; /* Use http or test-http mode for SSH */ | |
| 139 | + char *zSshUseHttp; /* Use http or test-http mode for SSH */ | |
| 140 | 140 | char *zSshFossilCmd; /* Path to remoe fossil command for SSH */ |
| 141 | 141 | char *zSshCmd; /* SSH command string */ |
| 142 | 142 | char *zFossilUser; /* Fossil user if different from URL user */ |
| 143 | 143 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| 144 | 144 | char *zPath; /* Name of webpage being served */ |
| @@ -582,11 +582,11 @@ | ||
| 582 | 582 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 583 | 583 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 584 | 584 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 585 | 585 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| 586 | 586 | g.fSshTrace = find_option("sshtrace", 0, 0)!=0; |
| 587 | - g.fSshUseHttp = 0; | |
| 587 | + g.zSshUseHttp = 0; | |
| 588 | 588 | g.zSshFossilCmd = 0; |
| 589 | 589 | g.zSshCmd = 0; |
| 590 | 590 | g.zFossilUser = 0; |
| 591 | 591 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 592 | 592 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 593 | 593 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -134,11 +134,11 @@ | |
| 134 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 135 | int fQuiet; /* True if -quiet flag is present */ |
| 136 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 137 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 138 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 139 | int fSshUseHttp; /* Use http or test-http mode for SSH */ |
| 140 | char *zSshFossilCmd; /* Path to remoe fossil command for SSH */ |
| 141 | char *zSshCmd; /* SSH command string */ |
| 142 | char *zFossilUser; /* Fossil user if different from URL user */ |
| 143 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| 144 | char *zPath; /* Name of webpage being served */ |
| @@ -582,11 +582,11 @@ | |
| 582 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 583 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 584 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 585 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| 586 | g.fSshTrace = find_option("sshtrace", 0, 0)!=0; |
| 587 | g.fSshUseHttp = 0; |
| 588 | g.zSshFossilCmd = 0; |
| 589 | g.zSshCmd = 0; |
| 590 | g.zFossilUser = 0; |
| 591 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 592 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 593 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -134,11 +134,11 @@ | |
| 134 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 135 | int fQuiet; /* True if -quiet flag is present */ |
| 136 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 137 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 138 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 139 | char *zSshUseHttp; /* Use http or test-http mode for SSH */ |
| 140 | char *zSshFossilCmd; /* Path to remoe fossil command for SSH */ |
| 141 | char *zSshCmd; /* SSH command string */ |
| 142 | char *zFossilUser; /* Fossil user if different from URL user */ |
| 143 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| 144 | char *zPath; /* Name of webpage being served */ |
| @@ -582,11 +582,11 @@ | |
| 582 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 583 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 584 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 585 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| 586 | g.fSshTrace = find_option("sshtrace", 0, 0)!=0; |
| 587 | g.zSshUseHttp = 0; |
| 588 | g.zSshFossilCmd = 0; |
| 589 | g.zSshCmd = 0; |
| 590 | g.zFossilUser = 0; |
| 591 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 592 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 593 |
+4
-4
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -69,11 +69,11 @@ | ||
| 69 | 69 | */ |
| 70 | 70 | configSync = CONFIGSET_SHUN; |
| 71 | 71 | } |
| 72 | 72 | #endif |
| 73 | 73 | if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE; |
| 74 | - is_fossil_user() ? | |
| 74 | + is_fossil_user() && url_ssh_use_http() ? | |
| 75 | 75 | fossil_print("Autosync: (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 76 | 76 | fossil_print("Autosync: %s\n", g.urlCanonical); |
| 77 | 77 | url_enable_proxy("via proxy: "); |
| 78 | 78 | rc = client_sync(flags, configSync, 0); |
| 79 | 79 | if( rc ) fossil_warning("Autosync failed"); |
| @@ -126,19 +126,19 @@ | ||
| 126 | 126 | usage("URL"); |
| 127 | 127 | } |
| 128 | 128 | user_select(); |
| 129 | 129 | if( g.argc==2 ){ |
| 130 | 130 | if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){ |
| 131 | - is_fossil_user() ? | |
| 131 | + is_fossil_user() && url_ssh_use_http() ? | |
| 132 | 132 | fossil_print("Sync with (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 133 | 133 | fossil_print("Sync with %s\n", g.urlCanonical); |
| 134 | 134 | }else if( (*pSyncFlags) & SYNC_PUSH ){ |
| 135 | - is_fossil_user() ? | |
| 135 | + is_fossil_user() && url_ssh_use_http() ? | |
| 136 | 136 | fossil_print("Push to (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 137 | 137 | fossil_print("Push to %s\n", g.urlCanonical); |
| 138 | 138 | }else if( (*pSyncFlags) & SYNC_PULL ){ |
| 139 | - is_fossil_user() ? | |
| 139 | + is_fossil_user() && url_ssh_use_http() ? | |
| 140 | 140 | fossil_print("Pull from (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 141 | 141 | fossil_print("Pull from %s\n", g.urlCanonical); |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | url_enable_proxy("via proxy: "); |
| 145 | 145 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -69,11 +69,11 @@ | |
| 69 | */ |
| 70 | configSync = CONFIGSET_SHUN; |
| 71 | } |
| 72 | #endif |
| 73 | if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE; |
| 74 | is_fossil_user() ? |
| 75 | fossil_print("Autosync: (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 76 | fossil_print("Autosync: %s\n", g.urlCanonical); |
| 77 | url_enable_proxy("via proxy: "); |
| 78 | rc = client_sync(flags, configSync, 0); |
| 79 | if( rc ) fossil_warning("Autosync failed"); |
| @@ -126,19 +126,19 @@ | |
| 126 | usage("URL"); |
| 127 | } |
| 128 | user_select(); |
| 129 | if( g.argc==2 ){ |
| 130 | if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){ |
| 131 | is_fossil_user() ? |
| 132 | fossil_print("Sync with (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 133 | fossil_print("Sync with %s\n", g.urlCanonical); |
| 134 | }else if( (*pSyncFlags) & SYNC_PUSH ){ |
| 135 | is_fossil_user() ? |
| 136 | fossil_print("Push to (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 137 | fossil_print("Push to %s\n", g.urlCanonical); |
| 138 | }else if( (*pSyncFlags) & SYNC_PULL ){ |
| 139 | is_fossil_user() ? |
| 140 | fossil_print("Pull from (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 141 | fossil_print("Pull from %s\n", g.urlCanonical); |
| 142 | } |
| 143 | } |
| 144 | url_enable_proxy("via proxy: "); |
| 145 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -69,11 +69,11 @@ | |
| 69 | */ |
| 70 | configSync = CONFIGSET_SHUN; |
| 71 | } |
| 72 | #endif |
| 73 | if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE; |
| 74 | is_fossil_user() && url_ssh_use_http() ? |
| 75 | fossil_print("Autosync: (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 76 | fossil_print("Autosync: %s\n", g.urlCanonical); |
| 77 | url_enable_proxy("via proxy: "); |
| 78 | rc = client_sync(flags, configSync, 0); |
| 79 | if( rc ) fossil_warning("Autosync failed"); |
| @@ -126,19 +126,19 @@ | |
| 126 | usage("URL"); |
| 127 | } |
| 128 | user_select(); |
| 129 | if( g.argc==2 ){ |
| 130 | if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){ |
| 131 | is_fossil_user() && url_ssh_use_http() ? |
| 132 | fossil_print("Sync with (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 133 | fossil_print("Sync with %s\n", g.urlCanonical); |
| 134 | }else if( (*pSyncFlags) & SYNC_PUSH ){ |
| 135 | is_fossil_user() && url_ssh_use_http() ? |
| 136 | fossil_print("Push to (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 137 | fossil_print("Push to %s\n", g.urlCanonical); |
| 138 | }else if( (*pSyncFlags) & SYNC_PULL ){ |
| 139 | is_fossil_user() && url_ssh_use_http() ? |
| 140 | fossil_print("Pull from (%s) %s\n", g.zFossilUser, g.urlCanonical) : |
| 141 | fossil_print("Pull from %s\n", g.urlCanonical); |
| 142 | } |
| 143 | } |
| 144 | url_enable_proxy("via proxy: "); |
| 145 |
+5
-3
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -412,11 +412,11 @@ | ||
| 412 | 412 | /* |
| 413 | 413 | ** Prompt the user for the password for g.urlUser. Store the result |
| 414 | 414 | ** in g.urlPasswd. |
| 415 | 415 | */ |
| 416 | 416 | void url_prompt_for_password(void){ |
| 417 | - if( g.urlIsFile || ( g.urlIsSsh && url_ssh_use_http()==0 ) ) return; | |
| 417 | + if( g.urlIsFile || ( g.urlIsSsh && ! url_ssh_use_http() ) ) return; | |
| 418 | 418 | if( isatty(fileno(stdin)) |
| 419 | 419 | && (g.urlFlags & URL_PROMPT_PW)!=0 |
| 420 | 420 | && (g.urlFlags & URL_PROMPTED)==0 |
| 421 | 421 | ){ |
| 422 | 422 | g.urlFlags |= URL_PROMPTED; |
| @@ -439,11 +439,12 @@ | ||
| 439 | 439 | |
| 440 | 440 | /* |
| 441 | 441 | ** Return true if http mode is in use for "ssh://" URL. |
| 442 | 442 | */ |
| 443 | 443 | int url_ssh_use_http(void){ |
| 444 | - return db_get_boolean("ssh-use-http", 0) || g.fSshUseHttp; | |
| 444 | + return ( g.zSshUseHttp && g.zSshUseHttp[0] ) ? is_truth(g.zSshUseHttp) : | |
| 445 | + db_get_boolean("ssh-use-http", 0); | |
| 445 | 446 | } |
| 446 | 447 | |
| 447 | 448 | /* |
| 448 | 449 | ** Remember the URL if requested. |
| 449 | 450 | */ |
| @@ -457,12 +458,13 @@ | ||
| 457 | 458 | |
| 458 | 459 | /* Preemptively prompt for a password if a username is given in the |
| 459 | 460 | ** URL but no password. |
| 460 | 461 | */ |
| 461 | 462 | void url_get_password_if_needed(void){ |
| 462 | - if( (g.urlUser && g.urlUser[0]) | |
| 463 | + const char *zFossilUser = url_or_fossil_user(); | |
| 464 | + if( ( zFossilUser && zFossilUser[0] ) | |
| 463 | 465 | && (g.urlPasswd==0 || g.urlPasswd[0]==0) |
| 464 | 466 | && isatty(fileno(stdin)) |
| 465 | 467 | ){ |
| 466 | 468 | url_prompt_for_password(); |
| 467 | 469 | } |
| 468 | 470 | } |
| 469 | 471 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -412,11 +412,11 @@ | |
| 412 | /* |
| 413 | ** Prompt the user for the password for g.urlUser. Store the result |
| 414 | ** in g.urlPasswd. |
| 415 | */ |
| 416 | void url_prompt_for_password(void){ |
| 417 | if( g.urlIsFile || ( g.urlIsSsh && url_ssh_use_http()==0 ) ) return; |
| 418 | if( isatty(fileno(stdin)) |
| 419 | && (g.urlFlags & URL_PROMPT_PW)!=0 |
| 420 | && (g.urlFlags & URL_PROMPTED)==0 |
| 421 | ){ |
| 422 | g.urlFlags |= URL_PROMPTED; |
| @@ -439,11 +439,12 @@ | |
| 439 | |
| 440 | /* |
| 441 | ** Return true if http mode is in use for "ssh://" URL. |
| 442 | */ |
| 443 | int url_ssh_use_http(void){ |
| 444 | return db_get_boolean("ssh-use-http", 0) || g.fSshUseHttp; |
| 445 | } |
| 446 | |
| 447 | /* |
| 448 | ** Remember the URL if requested. |
| 449 | */ |
| @@ -457,12 +458,13 @@ | |
| 457 | |
| 458 | /* Preemptively prompt for a password if a username is given in the |
| 459 | ** URL but no password. |
| 460 | */ |
| 461 | void url_get_password_if_needed(void){ |
| 462 | if( (g.urlUser && g.urlUser[0]) |
| 463 | && (g.urlPasswd==0 || g.urlPasswd[0]==0) |
| 464 | && isatty(fileno(stdin)) |
| 465 | ){ |
| 466 | url_prompt_for_password(); |
| 467 | } |
| 468 | } |
| 469 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -412,11 +412,11 @@ | |
| 412 | /* |
| 413 | ** Prompt the user for the password for g.urlUser. Store the result |
| 414 | ** in g.urlPasswd. |
| 415 | */ |
| 416 | void url_prompt_for_password(void){ |
| 417 | if( g.urlIsFile || ( g.urlIsSsh && ! url_ssh_use_http() ) ) return; |
| 418 | if( isatty(fileno(stdin)) |
| 419 | && (g.urlFlags & URL_PROMPT_PW)!=0 |
| 420 | && (g.urlFlags & URL_PROMPTED)==0 |
| 421 | ){ |
| 422 | g.urlFlags |= URL_PROMPTED; |
| @@ -439,11 +439,12 @@ | |
| 439 | |
| 440 | /* |
| 441 | ** Return true if http mode is in use for "ssh://" URL. |
| 442 | */ |
| 443 | int url_ssh_use_http(void){ |
| 444 | return ( g.zSshUseHttp && g.zSshUseHttp[0] ) ? is_truth(g.zSshUseHttp) : |
| 445 | db_get_boolean("ssh-use-http", 0); |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | ** Remember the URL if requested. |
| 450 | */ |
| @@ -457,12 +458,13 @@ | |
| 458 | |
| 459 | /* Preemptively prompt for a password if a username is given in the |
| 460 | ** URL but no password. |
| 461 | */ |
| 462 | void url_get_password_if_needed(void){ |
| 463 | const char *zFossilUser = url_or_fossil_user(); |
| 464 | if( ( zFossilUser && zFossilUser[0] ) |
| 465 | && (g.urlPasswd==0 || g.urlPasswd[0]==0) |
| 466 | && isatty(fileno(stdin)) |
| 467 | ){ |
| 468 | url_prompt_for_password(); |
| 469 | } |
| 470 | } |
| 471 |