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.

andybradford 2019-05-01 14:02 trunk
Commit 7063b1a3659638c35c987dd9be2cbb7d5b13e9938d65bb034209374a1faf377b
1 file changed +4 -2
+4 -2
--- src/user.c
+++ src/user.c
@@ -498,19 +498,21 @@
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{
508509
return;
509510
}
510511
}
511512
513
+ memset(&url, 0, sizeof(url));
512514
if( g.localOpen && attempt_user(db_lget("default-user",0)) ) return;
513515
514516
if( attempt_user(db_get("default-user", 0)) ) return;
515517
516518
if( attempt_user(fossil_getenv("FOSSIL_USER")) ) return;
@@ -519,12 +521,12 @@
519521
520522
if( attempt_user(fossil_getenv("LOGNAME")) ) return;
521523
522524
if( attempt_user(fossil_getenv("USERNAME")) ) return;
523525
524
- url_parse(0, 0);
525
- if( g.url.user && attempt_user(g.url.user) ) return;
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,19 +498,21 @@
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{
508 return;
509 }
510 }
511
 
512 if( g.localOpen && attempt_user(db_lget("default-user",0)) ) return;
513
514 if( attempt_user(db_get("default-user", 0)) ) return;
515
516 if( attempt_user(fossil_getenv("FOSSIL_USER")) ) return;
@@ -519,12 +521,12 @@
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,19 +498,21 @@
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{
509 return;
510 }
511 }
512
513 memset(&url, 0, sizeof(url));
514 if( g.localOpen && attempt_user(db_lget("default-user",0)) ) return;
515
516 if( attempt_user(db_get("default-user", 0)) ) return;
517
518 if( attempt_user(fossil_getenv("FOSSIL_USER")) ) return;
@@ -519,12 +521,12 @@
521
522 if( attempt_user(fossil_getenv("LOGNAME")) ) return;
523
524 if( attempt_user(fossil_getenv("USERNAME")) ) return;
525
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