Fossil

Check-in [36f916c504]
Login

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

Overview
Comment:More robust detection of top of a checkout in the dir_has_ckout_db() function.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 36f916c504c525c72f48585e844aa6bfda22a401f3297d21611cb1fd0fecd041
User & Date: drh 2024-12-11 00:32:37.166
Context
2024-12-11
11:41
Record the name of the branch for a checkout when the checkout is first opened. Possible use later to warn about branch name changes at check-in time. Leaf check-in: 706a10d09e user: drh tags: safe-checkout-branch
07:41
(Spell) Correct spelling in branch.c. check-in: 4bb718a882 user: brickviking tags: trunk
00:32
More robust detection of top of a checkout in the dir_has_ckout_db() function. check-in: 36f916c504 user: drh tags: trunk
2024-12-10
21:30
(Grammar) Correct sense of word. check-in: c7bfa9636a user: brickviking tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
2971
2972
2973
2974
2975
2976
2977

2978
2979
2980
2981
2982
2983
2984
2985
2986



2987
2988
2989
2990
2991
2992
2993

/*
** Returns 1 if the given directory contains a file named .fslckout, 2
** if it contains a file named _FOSSIL_, else returns 0.
*/
int dir_has_ckout_db(const char *zDir){
  int rc = 0;

  char * zCkoutDb = mprintf("%//.fslckout", zDir);
  if(file_isfile(zCkoutDb, ExtFILE)){
    rc = 1;
  }else{
    fossil_free(zCkoutDb);
    zCkoutDb = mprintf("%//_FOSSIL_", zDir);
    if(file_isfile(zCkoutDb, ExtFILE)){
      rc = 2;
    }



  }
  fossil_free(zCkoutDb);
  return rc;
}

/*
** This is the implementation of inode(FILENAME) SQL function.







>









>
>
>







2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997

/*
** Returns 1 if the given directory contains a file named .fslckout, 2
** if it contains a file named _FOSSIL_, else returns 0.
*/
int dir_has_ckout_db(const char *zDir){
  int rc = 0;
  i64 sz;
  char * zCkoutDb = mprintf("%//.fslckout", zDir);
  if(file_isfile(zCkoutDb, ExtFILE)){
    rc = 1;
  }else{
    fossil_free(zCkoutDb);
    zCkoutDb = mprintf("%//_FOSSIL_", zDir);
    if(file_isfile(zCkoutDb, ExtFILE)){
      rc = 2;
    }
  }
  if( rc && ((sz = file_size(zCkoutDb, ExtFILE))<1024 || (sz%512)!=0) ){
    rc = 0;
  }
  fossil_free(zCkoutDb);
  return rc;
}

/*
** This is the implementation of inode(FILENAME) SQL function.