Check-in [3946ff81b0]
Not logged in

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

Overview
Comment:Refactored [bf66d61582] to move the dir-has-a-checkout-db check into the new dir_has_ckout_db() routine.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3946ff81b038c5db4f14bd9eaf4e648518ab6624c41bb0a53e1667e7533d2d23
User & Date: stephan 2021-06-30 18:46:11.245
References
2021-06-30
22:58
Replaced part of [3946ff81] which was inadvertently removed via [612f6cee] (parallel edits). Removed an unused var. check-in: 4f095cdba0 user: stephan tags: trunk
Context
2021-06-30
18:55
Change log typo fix and added an all-encompassing 'numerous other minor enhancements' to 2.16. check-in: 56a40e3b9d user: stephan tags: trunk
18:46
Refactored [bf66d61582] to move the dir-has-a-checkout-db check into the new dir_has_ckout_db() routine. check-in: 3946ff81b0 user: stephan tags: trunk
17:57
Retroactively added a note to the 2.12.1 change log about the allow-symlinks setting no longer syncing, per forum request. check-in: c5dc24d4eb user: stephan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
2674
2675
2676
2677
2678
2679
2680





















    usage("FILENAME_1 [...FILENAME_N]");
  }
  for( i = 2; i < g.argc; ++i ){
    const int check = file_is_reserved_name(g.argv[i], -1);
    fossil_print("%d %s\n", check, g.argv[i]);
  }
}




























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
    usage("FILENAME_1 [...FILENAME_N]");
  }
  for( i = 2; i < g.argc; ++i ){
    const int check = file_is_reserved_name(g.argv[i], -1);
    fossil_print("%d %s\n", check, g.argv[i]);
  }
}


/*
** 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;
}
Changes to src/main.c.
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
  verify_all_options();

  if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
  if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
    /* If REPOSITORY arg is the root of a checkout,
    ** chdir to that checkout so that the current version
    ** gets highlighted in the timeline by default. */
    const char * zArg = g.argv[2];
    char * zCkoutDb = mprintf("%//.fslckout", zArg);
    if(file_size(zCkoutDb, ExtFILE)<=0){
      fossil_free(zCkoutDb);
      zCkoutDb = mprintf("%//_FOSSIL_", zArg);
      if(file_size(zCkoutDb, ExtFILE)<=0){
        fossil_free(zCkoutDb);
        zCkoutDb = 0;
      }
    }
    if(zCkoutDb!=0){
      fossil_free(zCkoutDb);
      if(0!=file_chdir(zArg, 0)){
        fossil_fatal("Cannot chdir to %s", zArg);
      }
      findServerArg = 99;
      fCreate = 0;
      g.argv[2] = 0;
      --g.argc;
    }
  }







|
<
<
<
<
<
<
|
<
<
<
<
|
|







2950
2951
2952
2953
2954
2955
2956
2957






2958




2959
2960
2961
2962
2963
2964
2965
2966
2967
  verify_all_options();

  if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
  if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
    /* If REPOSITORY arg is the root of a checkout,
    ** chdir to that checkout so that the current version
    ** gets highlighted in the timeline by default. */
    const char * zDir = g.argv[2];






    if(dir_has_ckout_db(zDir)){




      if(0!=file_chdir(zDir, 0)){
        fossil_fatal("Cannot chdir to %s", zDir);
      }
      findServerArg = 99;
      fCreate = 0;
      g.argv[2] = 0;
      --g.argc;
    }
  }