Fossil SCM

When attempting to determine the Fossil user information, do not smash the global URL information which may contain an alternate URL used for sync operations (e.g. when using 'fossil sync --once'). This fixes the ability to work offline and synchronize with a USB thumbdrive ala sneaker-net.

mistachkin 2019-05-17 19:07 trunk merge
Commit b9e36291f72703fa8c0aad2f713f778bf7fde146920f98f9cf9621ef01521fcf
1 file changed +4 -2
+4 -2
--- src/user.c
+++ src/user.c
@@ -498,10 +498,11 @@
498498
** (8) Check if the user can be extracted from the remote URL.
499499
**
500500
** The user name is stored in g.zLogin. The uid is in g.userUid.
501501
*/
502502
void user_select(void){
503
+ UrlData url;
503504
if( g.userUid ) return;
504505
if( g.zLogin ){
505506
if( attempt_user(g.zLogin)==0 ){
506507
fossil_fatal("no such user: %s", g.zLogin);
507508
}else{
@@ -519,12 +520,13 @@
519520
520521
if( attempt_user(fossil_getenv("LOGNAME")) ) return;
521522
522523
if( attempt_user(fossil_getenv("USERNAME")) ) return;
523524
524
- url_parse(0, 0);
525
- if( g.url.user && attempt_user(g.url.user) ) return;
525
+ memset(&url, 0, sizeof(url));
526
+ url_parse_local(0, 0, &url);
527
+ if( url.user && attempt_user(url.user) ) return;
526528
527529
fossil_print(
528530
"Cannot figure out who you are! Consider using the --user\n"
529531
"command line option, setting your USER environment variable,\n"
530532
"or setting a default user with \"fossil user default USER\".\n"
531533
--- src/user.c
+++ src/user.c
@@ -498,10 +498,11 @@
498 ** (8) Check if the user can be extracted from the remote URL.
499 **
500 ** The user name is stored in g.zLogin. The uid is in g.userUid.
501 */
502 void user_select(void){
 
503 if( g.userUid ) return;
504 if( g.zLogin ){
505 if( attempt_user(g.zLogin)==0 ){
506 fossil_fatal("no such user: %s", g.zLogin);
507 }else{
@@ -519,12 +520,13 @@
519
520 if( attempt_user(fossil_getenv("LOGNAME")) ) return;
521
522 if( attempt_user(fossil_getenv("USERNAME")) ) return;
523
524 url_parse(0, 0);
525 if( g.url.user && attempt_user(g.url.user) ) return;
 
526
527 fossil_print(
528 "Cannot figure out who you are! Consider using the --user\n"
529 "command line option, setting your USER environment variable,\n"
530 "or setting a default user with \"fossil user default USER\".\n"
531
--- src/user.c
+++ src/user.c
@@ -498,10 +498,11 @@
498 ** (8) Check if the user can be extracted from the remote URL.
499 **
500 ** The user name is stored in g.zLogin. The uid is in g.userUid.
501 */
502 void user_select(void){
503 UrlData url;
504 if( g.userUid ) return;
505 if( g.zLogin ){
506 if( attempt_user(g.zLogin)==0 ){
507 fossil_fatal("no such user: %s", g.zLogin);
508 }else{
@@ -519,12 +520,13 @@
520
521 if( attempt_user(fossil_getenv("LOGNAME")) ) return;
522
523 if( attempt_user(fossil_getenv("USERNAME")) ) return;
524
525 memset(&url, 0, sizeof(url));
526 url_parse_local(0, 0, &url);
527 if( url.user && attempt_user(url.user) ) return;
528
529 fossil_print(
530 "Cannot figure out who you are! Consider using the --user\n"
531 "command line option, setting your USER environment variable,\n"
532 "or setting a default user with \"fossil user default USER\".\n"
533

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button