Fossil

Diff
Login

Differences From Artifact [fcfc75c8b2]:

To Artifact [3ac17e30e1]:


525
526
527
528
529
530
531
532

533
534

535
536
537

538
539
540
541
542
543


544

545
546
547
548
549
550
551
525
526
527
528
529
530
531

532
533
534
535
536
537

538
539
540
541
542
543
544
545
546

547
548
549
550
551
552
553
554







-
+


+


-
+






+
+
-
+







  char zPwd[2000];
  if( g.localOpen) return 1;
  if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){
    db_err("pwd too big: max %d", sizeof(zPwd)-20);
  }
  n = strlen(zPwd);
  while( n>0 ){
    if( access(zPwd, W_OK) ) return 0;
    if( access(zPwd, W_OK) ) break;
    strcpy(&zPwd[n], "/_FOSSIL_");
    if( isValidLocalDb(zPwd) ){
      /* Found a valid _FOSSIL_ file */
      zPwd[n] = 0;
      g.zLocalRoot = mprintf("%s/", zPwd);
      break;
      return 1;
    }
    n--;
    while( n>0 && zPwd[n]!='/' ){ n--; }
    while( n>0 && zPwd[n-1]=='/' ){ n--; }
    zPwd[n] = 0;
  }

  /* A _FOSSIL_ file could not be found */
  return 1;
  return 0;
}

/*
** Open the repository database given by zDbName.  If zDbName==NULL then
** get the name from the already open local database.
*/
void db_open_repository(const char *zDbName){