Fossil

Changes On Branch offline-sync
Login

Changes On Branch offline-sync

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch offline-sync Excluding Merge-Ins

This is equivalent to a diff from ff9dbf36 to e5ac794f

2019-05-17
19:07
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. ... (check-in: b9e36291 user: mistachkin tags: trunk)
18:55
Minor coding style change. ... (Closed-Leaf check-in: e5ac794f user: mistachkin tags: offline-sync)
18:54
Merge updates from trunk. ... (check-in: be8b227b user: mistachkin tags: offline-sync)
17:20
Squelch an "unused variable" compiler warning in printf.c. ... (check-in: ff9dbf36 user: stephan tags: trunk)
17:08
Change redirect handling so that (1) status codes 307 and 308 are recognized as redirects in addition to 301 and 302 and (2) the remote URL is only changed if it encounters a permanent redirect (301 or 308). ... (check-in: f2ca4491 user: drh tags: trunk)

Changes to src/user.c.

496
497
498
499
500
501
502

503
504
505
506
507
508
509
**   (7)  Try the USERNAME environment variable.
**
**   (8)  Check if the user can be extracted from the remote URL.
**
** The user name is stored in g.zLogin.  The uid is in g.userUid.
*/
void user_select(void){

  if( g.userUid ) return;
  if( g.zLogin ){
    if( attempt_user(g.zLogin)==0 ){
      fossil_fatal("no such user: %s", g.zLogin);
    }else{
      return;
    }







>







496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
**   (7)  Try the USERNAME environment variable.
**
**   (8)  Check if the user can be extracted from the remote URL.
**
** The user name is stored in g.zLogin.  The uid is in g.userUid.
*/
void user_select(void){
  UrlData url;
  if( g.userUid ) return;
  if( g.zLogin ){
    if( attempt_user(g.zLogin)==0 ){
      fossil_fatal("no such user: %s", g.zLogin);
    }else{
      return;
    }
517
518
519
520
521
522
523

524
525
526
527
528
529
530
531
532

  if( attempt_user(fossil_getenv("USER")) ) return;

  if( attempt_user(fossil_getenv("LOGNAME")) ) return;

  if( attempt_user(fossil_getenv("USERNAME")) ) return;


  url_parse(0, 0);
  if( g.url.user && attempt_user(g.url.user) ) return;

  fossil_print(
    "Cannot figure out who you are!  Consider using the --user\n"
    "command line option, setting your USER environment variable,\n"
    "or setting a default user with \"fossil user default USER\".\n"
  );
  fossil_fatal("cannot determine user");







>
|
|







518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534

  if( attempt_user(fossil_getenv("USER")) ) return;

  if( attempt_user(fossil_getenv("LOGNAME")) ) return;

  if( attempt_user(fossil_getenv("USERNAME")) ) return;

  memset(&url, 0, sizeof(url));
  url_parse_local(0, 0, &url);
  if( url.user && attempt_user(url.user) ) return;

  fossil_print(
    "Cannot figure out who you are!  Consider using the --user\n"
    "command line option, setting your USER environment variable,\n"
    "or setting a default user with \"fossil user default USER\".\n"
  );
  fossil_fatal("cannot determine user");