Fossil

Changes On Branch allow-versioned-settings-comments
Login

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

Changes In Branch allow-versioned-settings-comments Excluding Merge-Ins

This is equivalent to a diff from 72d8240457 to fc2a4dccac

2023-04-19
07:19
Allow comment lines (starting with '#') in versioned settings. ... (check-in: ef633d4bb5 user: danield tags: trunk)
2023-04-10
08:46
Do not save the password for syncing operations if the user denied the save password prompt or if the FOSSIL_SECURITY_LEVEL environment variable is ≥1. ... (check-in: 2916ec970b user: florian tags: trunk)
2023-04-03
18:58
Allow comment lines (starting with '#') in versioned settings. ... (Closed-Leaf check-in: fc2a4dccac user: danield tags: allow-versioned-settings-comments)
2023-04-01
16:49
Added the CENGINE abstraction between `docker` and `podman` in the Makefile's container convenience targets. ... (check-in: 72d8240457 user: wyoung tags: trunk)
16:41
Removed all the "BBXVER" stuff in the containers doc now that we aren't fetching the BusyBox sources and building a custom version to install outside the jail. ... (check-in: b14165549c user: wyoung tags: trunk)

Changes to src/blob.c.
849
850
851
852
853
854
855















































































856
857
858
859
860
861
862
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    i++;
  }
  if( pTo ){
    blob_append(pTo, &pFrom->aData[pFrom->iCursor], i - pFrom->iCursor);
  }
  pFrom->iCursor = i;
}

/*
** Remove comment lines (starting with '#') from a blob pIn.
** Store the result in pOut.  It is ok for pIn and pOut to be the same blob.
**
** pOut must either be the same as pIn or else uninitialized.
*/
void blob_strip_comment_lines(Blob *pIn, Blob *pOut){
  char *z = pIn->aData;
  unsigned int i = 0;
  unsigned int n = pIn->nUsed;
  unsigned int lineStart = 0;
  int doCopy = 1;
  Blob temp;
  blob_zero(&temp);

  while( i<n ){
    if( i==lineStart && z[i]=='#' ){
      doCopy = 0;
    }
    if( z[i]=='\n' ){
      if( doCopy ) blob_append(&temp,&pIn->aData[lineStart], i - lineStart + 1);
      lineStart = i + 1;
      doCopy = 1;
    }
    i++;
  }
  /* Last line */
  if( doCopy ) blob_append(&temp, &pIn->aData[lineStart], i - lineStart);

  if( pOut==pIn ) blob_reset(pOut);
  *pOut = temp;
}

/*
** COMMAND: test-strip-comment-lines
**
** Usage: %fossil test-strip-comment-lines ?OPTIONS? INPUTFILE
**
** Read INPUTFILE and print it without comment lines (starting with '#').
**
** This is used to test and debug the blob_strip_comment_lines() routine.
**
** Options:
**   -y|--side-by-side    Show diff of INPUTFILE and output side-by-side
**   -W|--width N         Width of lines in side-by-side diff
*/
void test_strip_comment_lines_cmd(void){
  Blob f, h;   /* unitialized */
  Blob out;
  DiffConfig dCfg;
  int sbs = 0;
  const char *z;
  int w = 0;

  memset(&dCfg, 0, sizeof(dCfg));

  sbs = find_option("side-by-side","y",0)!=0;
  if( (z = find_option("width","W",1))!=0 && (w = atoi(z))>0 ){
    dCfg.wColumn = w;
  }  
  verify_all_options();
  if( g.argc!=3 ) usage("INPUTFILE");

  blob_read_from_file(&f, g.argv[2], ExtFILE);
  blob_strip_comment_lines(&f, &h);

  if ( !sbs ){
    blob_write_to_file(&h, "-");
  }else{
    blob_zero(&out);
    dCfg.nContext = -1;   /* whole content */
    dCfg.diffFlags = DIFF_SIDEBYSIDE | DIFF_CONTEXT_EX | DIFF_STRIP_EOLCR;
    diff_begin(&dCfg);
    text_diff(&f, &h, &out, &dCfg);
    blob_write_to_file(&out, "-");
    diff_end(&dCfg, 0);
  }
}

/*
** Ensure that the text in pBlob ends with '\n'
*/
void blob_add_final_newline(Blob *pBlob){
  if( pBlob->nUsed<=0 ) return;
  if( pBlob->aData[pBlob->nUsed-1]!='\n' ){
Changes to src/db.c.
3292
3293
3294
3295
3296
3297
3298

3299
3300
3301
3302
3303
3304
3305
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306







+







      blob_append(&versionedPathname, ".no-warn", -1);
      if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){
        noWarn = 1;
      }
    }
    blob_reset(&versionedPathname);
    if( found ){
      blob_strip_comment_lines(&setting, &setting);
      blob_trim(&setting); /* Avoid non-obvious problems with line endings
                           ** on boolean properties */
      zVersionedSetting = fossil_strdup(blob_str(&setting));
    }
    blob_reset(&setting);
    /* Store result in cache, which can be the value or 0 if not found */
    cacheEntry = (struct _cacheEntry*)fossil_malloc(sizeof(struct _cacheEntry));