Fossil

Check-in [84abd45533]
Login

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

Overview
Comment:Remove traces. Waiting approval to merge on trunk..
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | checkout_on_root_fix
Files: files | file ages | folders
SHA1: 84abd455338f32e7bf68f72f3d5298465247da80
User & Date: mgagnon 2014-01-08 04:59:36.115
Context
2014-01-08
17:40
<strong>Fix some remaining corner cases when having a checkout on '/'..</strong> Update command: * Was asserting when localroot is '/' file_cannonical_name(): * Return '/' instead of '.' when refering to '/'. * Avoid the double '/' on beginning. * Refactoring to avoid some duplicated code. file_relative_name(): * Handle properly relative path when working on '/'. Closed-Leaf check-in: 89ad123f5c user: mgagnon tags: checkout_on_root_fix
11:38
Merge the checkout_on_root_fix. check-in: cbcd7056b6 user: drh tags: trunk
04:59
Remove traces. Waiting approval to merge on trunk.. check-in: 84abd45533 user: mgagnon tags: checkout_on_root_fix
04:42
Fix db_open_local() fonction so it find the local checkout database on "/". It was working inconsistently depending what was the current directory. ** Even if fossil is not the right tool to version files on the root of the system, I found it very usefull to track what file change on my system Tested on Linux and MinGW (Windows 8.1) check-in: be993c47d5 user: mgagnon tags: checkout_on_root_fix
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
** to the root of the repository tree and this routine returns 1.  If
** no database is found, then this routine return 0.
**
** This routine always opens the user database regardless of whether or
** not the repository database is found.  If the _FOSSIL_ or .fslckout file
** is found, it is attached to the open database connection too.
*/
/* #define DBG_CHECKOUT_ON_ROOT_FIX 1 */
int db_open_local(const char *zDbName){
  int i, n;
  char zPwd[2000];
  static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };

  if( g.localOpen) return 1;
  file_getcwd(zPwd, sizeof(zPwd)-20);
  n = strlen(zPwd);
#ifdef DBG_CHECKOUT_ON_ROOT_FIX
  fossil_trace("---> DEBUG: zPwd: %s, n: %d\n", zPwd, n);
#endif
  while( n>0 ){
    for(i=0; i<count(aDbName); i++){
      sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
      if( isValidLocalDb(zPwd) ){
        /* Found a valid checkout database file */
        zPwd[n] = 0;
        while( n>0 && zPwd[n-1]=='/' ){
          n--;
          zPwd[n] = 0;
        }
        g.zLocalRoot = mprintf("%s/", zPwd);
#ifdef DBG_CHECKOUT_ON_ROOT_FIX
        fossil_trace("---> DEBUG: g.zLocalRoot: %s\n", g.zLocalRoot);
#endif
        g.localOpen = 1;
        db_open_config(0);
        db_open_repository(zDbName);
        return 1;
      }
    }
    n--;
    while( n>1 && zPwd[n]!='/' ){ n--; }
    while( n>1 && zPwd[n-1]=='/' ){ n--; }
    zPwd[n] = 0;
#ifdef DBG_CHECKOUT_ON_ROOT_FIX
    fossil_trace("---> DEBUG: next zPwd: %s, n: %d\n", zPwd, n);
#endif
  }

  /* A checkout database file could not be found */
  return 0;
}

/*







<








<
<
<











<
<
<










<
<
<







932
933
934
935
936
937
938

939
940
941
942
943
944
945
946



947
948
949
950
951
952
953
954
955
956
957



958
959
960
961
962
963
964
965
966
967



968
969
970
971
972
973
974
** to the root of the repository tree and this routine returns 1.  If
** no database is found, then this routine return 0.
**
** This routine always opens the user database regardless of whether or
** not the repository database is found.  If the _FOSSIL_ or .fslckout file
** is found, it is attached to the open database connection too.
*/

int db_open_local(const char *zDbName){
  int i, n;
  char zPwd[2000];
  static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };

  if( g.localOpen) return 1;
  file_getcwd(zPwd, sizeof(zPwd)-20);
  n = strlen(zPwd);



  while( n>0 ){
    for(i=0; i<count(aDbName); i++){
      sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
      if( isValidLocalDb(zPwd) ){
        /* Found a valid checkout database file */
        zPwd[n] = 0;
        while( n>0 && zPwd[n-1]=='/' ){
          n--;
          zPwd[n] = 0;
        }
        g.zLocalRoot = mprintf("%s/", zPwd);



        g.localOpen = 1;
        db_open_config(0);
        db_open_repository(zDbName);
        return 1;
      }
    }
    n--;
    while( n>1 && zPwd[n]!='/' ){ n--; }
    while( n>1 && zPwd[n-1]=='/' ){ n--; }
    zPwd[n] = 0;



  }

  /* A checkout database file could not be found */
  return 0;
}

/*