Fossil SCM
Fix the "fossil remote add NAME default" command so that it works to assign the name of NAME to the last sync URL.
Commit
ce1a1fd1d17659f2a94770135a3286986fb858742a837502c9de5d5b082dfc01
Parent
0abeed1118d726c…
1 file changed
+6
-1
+6
-1
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -607,12 +607,17 @@ | ||
| 607 | 607 | if( g.argc!=5 ) usage("add NAME URL"); |
| 608 | 608 | memset(&x, 0, sizeof(x)); |
| 609 | 609 | zName = g.argv[3]; |
| 610 | 610 | zUrl = g.argv[4]; |
| 611 | 611 | if( strcmp(zName,"default")==0 ) goto remote_add_default; |
| 612 | - url_parse_local(zUrl, URL_PROMPT_PW, &x); | |
| 613 | 612 | db_begin_write(); |
| 613 | + if( fossil_strcmp(zUrl,"default")==0 ){ | |
| 614 | + x.canonical = db_get("last-sync-url",0); | |
| 615 | + x.passwd = unobscure(db_get("last-sync-pw",0)); | |
| 616 | + }else{ | |
| 617 | + url_parse_local(zUrl, URL_PROMPT_PW, &x); | |
| 618 | + } | |
| 614 | 619 | db_unprotect(PROTECT_CONFIG); |
| 615 | 620 | db_multi_exec( |
| 616 | 621 | "REPLACE INTO config(name, value, mtime)" |
| 617 | 622 | " VALUES('sync-url:%q',%Q,now())", |
| 618 | 623 | zName, x.canonical |
| 619 | 624 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -607,12 +607,17 @@ | |
| 607 | if( g.argc!=5 ) usage("add NAME URL"); |
| 608 | memset(&x, 0, sizeof(x)); |
| 609 | zName = g.argv[3]; |
| 610 | zUrl = g.argv[4]; |
| 611 | if( strcmp(zName,"default")==0 ) goto remote_add_default; |
| 612 | url_parse_local(zUrl, URL_PROMPT_PW, &x); |
| 613 | db_begin_write(); |
| 614 | db_unprotect(PROTECT_CONFIG); |
| 615 | db_multi_exec( |
| 616 | "REPLACE INTO config(name, value, mtime)" |
| 617 | " VALUES('sync-url:%q',%Q,now())", |
| 618 | zName, x.canonical |
| 619 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -607,12 +607,17 @@ | |
| 607 | if( g.argc!=5 ) usage("add NAME URL"); |
| 608 | memset(&x, 0, sizeof(x)); |
| 609 | zName = g.argv[3]; |
| 610 | zUrl = g.argv[4]; |
| 611 | if( strcmp(zName,"default")==0 ) goto remote_add_default; |
| 612 | db_begin_write(); |
| 613 | if( fossil_strcmp(zUrl,"default")==0 ){ |
| 614 | x.canonical = db_get("last-sync-url",0); |
| 615 | x.passwd = unobscure(db_get("last-sync-pw",0)); |
| 616 | }else{ |
| 617 | url_parse_local(zUrl, URL_PROMPT_PW, &x); |
| 618 | } |
| 619 | db_unprotect(PROTECT_CONFIG); |
| 620 | db_multi_exec( |
| 621 | "REPLACE INTO config(name, value, mtime)" |
| 622 | " VALUES('sync-url:%q',%Q,now())", |
| 623 | zName, x.canonical |
| 624 |