Fossil

Check-in [f12609fc]
Login

Check-in [f12609fc]

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

Overview
Comment:Switched the empty-dirs setting handler from a one-off parser to glob_create() both so we get consistent behavior across the settings and because glob_create() allows quoted whitespace, needed when asking it to create directories with spaces in them. Addresses this forum report.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f12609fcaa95ac4ce6147a1fbd1e229d14606cd4158caf3f050e998d0d86b707
User & Date: wyoung 2023-05-22 22:11:07
Context
2023-05-22
22:23
Brought the globs doc back into line with the underlying implementation, and to mention the new treatement of the empty-dirs setting's value. ... (check-in: 2c0b70eb user: wyoung tags: trunk)
22:11
Switched the empty-dirs setting handler from a one-off parser to glob_create() both so we get consistent behavior across the settings and because glob_create() allows quoted whitespace, needed when asking it to create directories with spaces in them. Addresses this forum report. ... (check-in: f12609fc user: wyoung tags: trunk)
21:32
Updated the function comment on glob_create() to match what it actually does. ... (check-in: c43205d7 user: wyoung tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
/*
** SETTING: editor          width=32 sensitive
** The value is an external command that will launch the
** text editor command used for check-in comments.
*/
/*
** SETTING: empty-dirs      width=40 versionable block-text
** The value is a comma or newline-separated list of pathnames. On
** update and checkout commands, if no file or directory
** exists with that name, an empty directory will be
** created.
*/
/*
** SETTING: encoding-glob   width=40 versionable block-text
** The value is a comma or newline-separated list of GLOB
** patterns specifying files that the "commit" command will
** ignore when issuing warnings about text files that may
** use another encoding than ASCII or UTF-8. Set to "*"







|
|
|
|







4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
/*
** SETTING: editor          width=32 sensitive
** The value is an external command that will launch the
** text editor command used for check-in comments.
*/
/*
** SETTING: empty-dirs      width=40 versionable block-text
** The value is a list of pathnames parsed according to the same rules as
** the *-glob settings.  On update and checkout commands, if no directory
** exists with that name, an empty directory will be be created, even if
** it must create one or more parent directories.
*/
/*
** SETTING: encoding-glob   width=40 versionable block-text
** The value is a comma or newline-separated list of GLOB
** patterns specifying files that the "commit" command will
** ignore when issuing warnings about text files that may
** use another encoding than ASCII or UTF-8. Set to "*"

Changes to src/update.c.

650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
/*
** Create empty directories specified by the empty-dirs setting.
*/
void ensure_empty_dirs_created(int clearDirTable){
  char *zEmptyDirs = db_get("empty-dirs", 0);
  if( zEmptyDirs!=0 ){
    int i;
    Blob dirName;
    Blob dirsList;

    zEmptyDirs = fossil_strdup(zEmptyDirs);
    for(i=0; zEmptyDirs[i]; i++){
      if( zEmptyDirs[i]==',' ) zEmptyDirs[i] = ' ';
    }
    blob_init(&dirsList, zEmptyDirs, -1);
    while( blob_token(&dirsList, &dirName) ){
      char *zDir = blob_str(&dirName);
      char *zPath = mprintf("%s/%s", g.zLocalRoot, zDir);
      switch( file_isdir(zPath, RepoFILE) ){
        case 0: { /* doesn't exist */
          fossil_free(zPath);
          zPath = mprintf("%s/%s/x", g.zLocalRoot, zDir);
          if( file_mkfolder(zPath, RepoFILE, 0, 1)!=0 ) {
            fossil_warning("couldn't create directory %s as "







|
<

<
|
<
<
<
<
|







650
651
652
653
654
655
656
657

658

659




660
661
662
663
664
665
666
667
/*
** Create empty directories specified by the empty-dirs setting.
*/
void ensure_empty_dirs_created(int clearDirTable){
  char *zEmptyDirs = db_get("empty-dirs", 0);
  if( zEmptyDirs!=0 ){
    int i;
    Glob *pGlob = glob_create(zEmptyDirs);



    for(i=0; i<pGlob->nPattern; i++){




      const char *zDir = pGlob->azPattern[i];
      char *zPath = mprintf("%s/%s", g.zLocalRoot, zDir);
      switch( file_isdir(zPath, RepoFILE) ){
        case 0: { /* doesn't exist */
          fossil_free(zPath);
          zPath = mprintf("%s/%s/x", g.zLocalRoot, zDir);
          if( file_mkfolder(zPath, RepoFILE, 0, 1)!=0 ) {
            fossil_warning("couldn't create directory %s as "
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
        }
        case 2: { /* exists, but isn't a directory */
          fossil_warning("file %s found, but a directory is required "
                         "by empty-dirs setting", zDir);
        }
      }
      fossil_free(zPath);
      blob_reset(&dirName);
    }
    blob_reset(&dirsList);
    fossil_free(zEmptyDirs);
  }
}

/*
** Get the manifest record for a given revision, or the current check-out if
** zRevision is NULL.
*/







<

<
|







680
681
682
683
684
685
686

687

688
689
690
691
692
693
694
695
        }
        case 2: { /* exists, but isn't a directory */
          fossil_warning("file %s found, but a directory is required "
                         "by empty-dirs setting", zDir);
        }
      }
      fossil_free(zPath);

    }

    glob_free(pGlob);
  }
}

/*
** Get the manifest record for a given revision, or the current check-out if
** zRevision is NULL.
*/

Changes to www/changes.wiki.

28
29
30
31
32
33
34



35
36
37
38
39
40
41
  *  Comment lines (starting with a '#') are now supported inside 
     [./settings.wiki#versionable|versioned settings].
  *  Default permissions for anonymous users in new repositories is
     changed to "hz".
  *  The [/help?cmd=status|fossil status] command now detects when a
     file used to be a symlink and has been replaced by a regular file.
     (It previously checked for the inverse case only.)




<h2 id='v2_21'>Changes for version 2.21 (2023-02-25)</h2>
  *  Users can request a password reset.  This feature is disabledby default.  Use
     the new [/help?cmd=self-pw-reset|self-pw-reset property] to enable it.
     New web pages [/help?cmd=/resetpw|/resetpw] and
     [/help?cmd=/reqpwreset|/reqpwreset] added.
  *  Add the [/help?cmd=repack|fossil repack] command (together with







>
>
>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  *  Comment lines (starting with a '#') are now supported inside 
     [./settings.wiki#versionable|versioned settings].
  *  Default permissions for anonymous users in new repositories is
     changed to "hz".
  *  The [/help?cmd=status|fossil status] command now detects when a
     file used to be a symlink and has been replaced by a regular file.
     (It previously checked for the inverse case only.)
  *  The [/help?cmd=empty-dirs|empty-dirs setting] now reuses the same
     parser as the *-glob settings instead of its prior idiosyncratic
     parser, allowing quoted whitespace in patterns.

<h2 id='v2_21'>Changes for version 2.21 (2023-02-25)</h2>
  *  Users can request a password reset.  This feature is disabledby default.  Use
     the new [/help?cmd=self-pw-reset|self-pw-reset property] to enable it.
     New web pages [/help?cmd=/resetpw|/resetpw] and
     [/help?cmd=/reqpwreset|/reqpwreset] added.
  *  Add the [/help?cmd=repack|fossil repack] command (together with