Fossil SCM

Change the "legacy comment printing algorithm" to the "canonical comment printing algorithm". Omit the --comfmtflags and --comment-format global flags. Simplify the comment printing code.

drh 2025-03-03 12:07 trunk
Commit 35302d9e5054c11da68f5a0287d2f751509388711203b4c6fc55311e63d4b554
+85 -58
--- src/comformat.c
+++ src/comformat.c
@@ -21,18 +21,22 @@
2121
#include "config.h"
2222
#include "comformat.h"
2323
#include <assert.h>
2424
2525
#if INTERFACE
26
-#define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags = non-legacy. */
27
-#define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
26
+#define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags */
27
+#define COMMENT_PRINT_CANONICAL ((u32)0x00000001) /* Use canonical algorithm */
28
+#define COMMENT_PRINT_DEFAULT COMMENT_PRINT_CANONICAL /* Default */
29
+#define COMMENT_PRINT_UNSET (-1) /* Not initialized */
30
+
31
+/* The canonical comment printing algorithm is recommended. We make
32
+** no promise of on-going support for any of the following flags:
33
+*/
2834
#define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
2935
#define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
3036
#define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
3137
#define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
32
-#define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
33
-#define COMMENT_PRINT_UNSET (-1) /* Not initialized. */
3438
#endif
3539
3640
/********* Code copied from SQLite src/shell.c.in on 2024-09-30 **********/
3741
/* Lookup table to estimate the number of columns consumed by a Unicode
3842
** character.
@@ -483,21 +487,29 @@
483487
*pzLine = zLine + index;
484488
}
485489
}
486490
487491
/*
488
-** This is the legacy comment printing algorithm. It is being retained
489
-** for backward compatibility.
492
+** This is the canonical comment printing algorithm. This is the algorithm
493
+** that is recommended and that is used unless the administrator has made
494
+** special arrangements to use a customized algorithm.
490495
**
491496
** Given a comment string, format that string for printing on a TTY.
492
-** Assume that the output cursors is indent spaces from the left margin
497
+** Assume that the output cursor is indent spaces from the left margin
493498
** and that a single line can contain no more than 'width' characters.
494499
** Indent all subsequent lines by 'indent'.
495500
**
501
+** Formatting features:
502
+**
503
+** * Leading whitespace is removed.
504
+** * Internal whitespace sequences are changed into a single space (0x20)
505
+** character.
506
+** * Lines are broken at a space, or at a hyphen ("-") whenever possible.
507
+**
496508
** Returns the number of new lines emitted.
497509
*/
498
-static int comment_print_legacy(
510
+static int comment_print_canonical(
499511
const char *zText, /* The comment text to be printed. */
500512
int indent, /* Number of spaces to indent each non-initial line. */
501513
int width /* Maximum number of characters per line. */
502514
){
503515
int maxChars = width - indent;
@@ -582,13 +594,18 @@
582594
** This is the comment printing function. The comment printing algorithm
583595
** contained within it attempts to preserve the formatting present within
584596
** the comment string itself while honoring line width limitations. There
585597
** are several flags that modify the default behavior of this function:
586598
**
587
-** COMMENT_PRINT_LEGACY: Forces use of the legacy comment printing
588
-** algorithm. For backward compatibility,
589
-** this is the default.
599
+** COMMENT_PRINT_CANONICAL: Use the canonical printing algorithm:
600
+** * Omit leading and trailing whitespace
601
+** * Collapse internal whitespace into a
602
+** single space (0x20) character.
603
+** * Attempt to break lines at whitespace
604
+** or hyphens.
605
+** This is the recommended algorithm and is
606
+** used in most cases.
590607
**
591608
** COMMENT_PRINT_TRIM_CRLF: Trims leading and trailing carriage-returns
592609
** and line-feeds where they do not materially
593610
** impact pre-existing formatting (i.e. at the
594611
** start of the comment string -AND- right
@@ -631,56 +648,61 @@
631648
int indent, /* Spaces to indent each non-initial line. */
632649
int width, /* Maximum number of characters per line. */
633650
int flags /* Zero or more "COMMENT_PRINT_*" flags. */
634651
){
635652
int maxChars = width - indent;
636
- int legacy = flags & COMMENT_PRINT_LEGACY;
637
- int trimCrLf = flags & COMMENT_PRINT_TRIM_CRLF;
638
- int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE;
639
- int wordBreak = flags & COMMENT_PRINT_WORD_BREAK;
640
- int origBreak = flags & COMMENT_PRINT_ORIG_BREAK;
641
- int lineCnt = 0;
642
- const char *zLine;
643
-
644
- if( legacy ){
645
- return comment_print_legacy(zText, indent, width);
646
- }
647
- if( width<0 ){
648
- comment_set_maxchars(indent, &maxChars);
649
- }
650
- if( zText==0 ) zText = "(NULL)";
651
- if( maxChars<=0 ){
652
- maxChars = strlen(zText);
653
- }
654
- if( trimSpace ){
655
- while( fossil_isspace(zText[0]) ){ zText++; }
656
- }
657
- if( zText[0]==0 ){
658
- fossil_print("\n");
659
- lineCnt++;
660
- return lineCnt;
661
- }
662
- zLine = zText;
663
- for(;;){
664
- comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0,
665
- maxChars, trimCrLf, trimSpace, wordBreak, origBreak,
666
- &lineCnt, &zLine);
667
- if( zLine==0 ) break;
668
- while( fossil_isspace(zLine[0]) ) zLine++;
669
- if( zLine[0]==0 ) break;
670
- }
671
- return lineCnt;
653
+
654
+ if( flags & COMMENT_PRINT_CANONICAL ){
655
+ /* Use the canonical algorithm. This is what happens in almost
656
+ ** all cases. */
657
+ return comment_print_canonical(zText, indent, width);
658
+ }else{
659
+ /* The remaining is a more complex formatting algorithm that is very
660
+ ** seldom used and is considered deprecated.
661
+ */
662
+ int trimCrLf = flags & COMMENT_PRINT_TRIM_CRLF;
663
+ int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE;
664
+ int wordBreak = flags & COMMENT_PRINT_WORD_BREAK;
665
+ int origBreak = flags & COMMENT_PRINT_ORIG_BREAK;
666
+ int lineCnt = 0;
667
+ const char *zLine;
668
+
669
+ if( width<0 ){
670
+ comment_set_maxchars(indent, &maxChars);
671
+ }
672
+ if( zText==0 ) zText = "(NULL)";
673
+ if( maxChars<=0 ){
674
+ maxChars = strlen(zText);
675
+ }
676
+ if( trimSpace ){
677
+ while( fossil_isspace(zText[0]) ){ zText++; }
678
+ }
679
+ if( zText[0]==0 ){
680
+ fossil_print("\n");
681
+ lineCnt++;
682
+ return lineCnt;
683
+ }
684
+ zLine = zText;
685
+ for(;;){
686
+ comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0,
687
+ maxChars, trimCrLf, trimSpace, wordBreak, origBreak,
688
+ &lineCnt, &zLine);
689
+ if( zLine==0 ) break;
690
+ while( fossil_isspace(zLine[0]) ) zLine++;
691
+ if( zLine[0]==0 ) break;
692
+ }
693
+ return lineCnt;
694
+ }
672695
}
673696
674697
/*
675698
** Return the "COMMENT_PRINT_*" flags specified by the following sources,
676699
** evaluated in the following cascading order:
677700
**
678
-** 1. The global --comfmtflags (alias --comment-format) command-line option.
679
-** 2. The local (per-repository) "comment-format" setting.
680
-** 3. The global (all-repositories) "comment-format" setting.
681
-** 4. The default value COMMENT_PRINT_DEFAULT.
701
+** 1. The local (per-repository) "comment-format" setting.
702
+** 2. The global (all-repositories) "comment-format" setting.
703
+** 3. The default value COMMENT_PRINT_DEFAULT.
682704
*/
683705
int get_comment_format(){
684706
int comFmtFlags;
685707
686708
/* We must cache this result, else running the timeline can end up
@@ -712,22 +734,27 @@
712734
** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?ORIGTEXT?
713735
**
714736
** Test comment formatting and printing. Use for testing only.
715737
**
716738
** Options:
739
+** --canonical Use the canonical comment printing algorithm:
740
+** * Omit leading/trailing whitespace
741
+** * Collapse internal whitespace into a single
742
+** space character.
743
+** * Attempt to break lines at whitespace or at
744
+** a hyphen.
717745
** --file The comment text is really just a file name to
718746
** read it from
719747
** --decode Decode the text using the same method used when
720748
** handling the value of a C-card from a manifest.
721
-** --legacy Use the legacy comment printing algorithm
749
+** --indent Number of spaces to indent (default (-1) is to
750
+** auto-detect). Zero means no indent.
751
+** --origbreak Attempt to break when the original comment text
752
+** is detected
722753
** --trimcrlf Enable trimming of leading/trailing CR/LF
723754
** --trimspace Enable trimming of leading/trailing spaces
724755
** --wordbreak Attempt to break lines on word boundaries
725
-** --origbreak Attempt to break when the original comment text
726
-** is detected
727
-** --indent Number of spaces to indent (default (-1) is to
728
-** auto-detect). Zero means no indent.
729756
** -W|--width NUM Width of lines (default (-1) is to auto-detect).
730757
** Zero means no limit.
731758
*/
732759
void test_comment_format(void){
733760
const char *zWidth;
@@ -737,12 +764,12 @@
737764
char *zOrigText;
738765
int indent, width;
739766
int fromFile = find_option("file", 0, 0)!=0;
740767
int decode = find_option("decode", 0, 0)!=0;
741768
int flags = COMMENT_PRINT_NONE;
742
- if( find_option("legacy", 0, 0) ){
743
- flags |= COMMENT_PRINT_LEGACY;
769
+ if( find_option("original",0,0) ){
770
+ flags |= COMMENT_PRINT_CANONICAL;
744771
}
745772
if( find_option("trimcrlf", 0, 0) ){
746773
flags |= COMMENT_PRINT_TRIM_CRLF;
747774
}
748775
if( find_option("trimspace", 0, 0) ){
749776
--- src/comformat.c
+++ src/comformat.c
@@ -21,18 +21,22 @@
21 #include "config.h"
22 #include "comformat.h"
23 #include <assert.h>
24
25 #if INTERFACE
26 #define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags = non-legacy. */
27 #define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
 
 
 
 
 
 
28 #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
29 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
30 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
31 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
32 #define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
33 #define COMMENT_PRINT_UNSET (-1) /* Not initialized. */
34 #endif
35
36 /********* Code copied from SQLite src/shell.c.in on 2024-09-30 **********/
37 /* Lookup table to estimate the number of columns consumed by a Unicode
38 ** character.
@@ -483,21 +487,29 @@
483 *pzLine = zLine + index;
484 }
485 }
486
487 /*
488 ** This is the legacy comment printing algorithm. It is being retained
489 ** for backward compatibility.
 
490 **
491 ** Given a comment string, format that string for printing on a TTY.
492 ** Assume that the output cursors is indent spaces from the left margin
493 ** and that a single line can contain no more than 'width' characters.
494 ** Indent all subsequent lines by 'indent'.
495 **
 
 
 
 
 
 
 
496 ** Returns the number of new lines emitted.
497 */
498 static int comment_print_legacy(
499 const char *zText, /* The comment text to be printed. */
500 int indent, /* Number of spaces to indent each non-initial line. */
501 int width /* Maximum number of characters per line. */
502 ){
503 int maxChars = width - indent;
@@ -582,13 +594,18 @@
582 ** This is the comment printing function. The comment printing algorithm
583 ** contained within it attempts to preserve the formatting present within
584 ** the comment string itself while honoring line width limitations. There
585 ** are several flags that modify the default behavior of this function:
586 **
587 ** COMMENT_PRINT_LEGACY: Forces use of the legacy comment printing
588 ** algorithm. For backward compatibility,
589 ** this is the default.
 
 
 
 
 
590 **
591 ** COMMENT_PRINT_TRIM_CRLF: Trims leading and trailing carriage-returns
592 ** and line-feeds where they do not materially
593 ** impact pre-existing formatting (i.e. at the
594 ** start of the comment string -AND- right
@@ -631,56 +648,61 @@
631 int indent, /* Spaces to indent each non-initial line. */
632 int width, /* Maximum number of characters per line. */
633 int flags /* Zero or more "COMMENT_PRINT_*" flags. */
634 ){
635 int maxChars = width - indent;
636 int legacy = flags & COMMENT_PRINT_LEGACY;
637 int trimCrLf = flags & COMMENT_PRINT_TRIM_CRLF;
638 int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE;
639 int wordBreak = flags & COMMENT_PRINT_WORD_BREAK;
640 int origBreak = flags & COMMENT_PRINT_ORIG_BREAK;
641 int lineCnt = 0;
642 const char *zLine;
643
644 if( legacy ){
645 return comment_print_legacy(zText, indent, width);
646 }
647 if( width<0 ){
648 comment_set_maxchars(indent, &maxChars);
649 }
650 if( zText==0 ) zText = "(NULL)";
651 if( maxChars<=0 ){
652 maxChars = strlen(zText);
653 }
654 if( trimSpace ){
655 while( fossil_isspace(zText[0]) ){ zText++; }
656 }
657 if( zText[0]==0 ){
658 fossil_print("\n");
659 lineCnt++;
660 return lineCnt;
661 }
662 zLine = zText;
663 for(;;){
664 comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0,
665 maxChars, trimCrLf, trimSpace, wordBreak, origBreak,
666 &lineCnt, &zLine);
667 if( zLine==0 ) break;
668 while( fossil_isspace(zLine[0]) ) zLine++;
669 if( zLine[0]==0 ) break;
670 }
671 return lineCnt;
 
 
 
 
 
 
672 }
673
674 /*
675 ** Return the "COMMENT_PRINT_*" flags specified by the following sources,
676 ** evaluated in the following cascading order:
677 **
678 ** 1. The global --comfmtflags (alias --comment-format) command-line option.
679 ** 2. The local (per-repository) "comment-format" setting.
680 ** 3. The global (all-repositories) "comment-format" setting.
681 ** 4. The default value COMMENT_PRINT_DEFAULT.
682 */
683 int get_comment_format(){
684 int comFmtFlags;
685
686 /* We must cache this result, else running the timeline can end up
@@ -712,22 +734,27 @@
712 ** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?ORIGTEXT?
713 **
714 ** Test comment formatting and printing. Use for testing only.
715 **
716 ** Options:
 
 
 
 
 
 
717 ** --file The comment text is really just a file name to
718 ** read it from
719 ** --decode Decode the text using the same method used when
720 ** handling the value of a C-card from a manifest.
721 ** --legacy Use the legacy comment printing algorithm
 
 
 
722 ** --trimcrlf Enable trimming of leading/trailing CR/LF
723 ** --trimspace Enable trimming of leading/trailing spaces
724 ** --wordbreak Attempt to break lines on word boundaries
725 ** --origbreak Attempt to break when the original comment text
726 ** is detected
727 ** --indent Number of spaces to indent (default (-1) is to
728 ** auto-detect). Zero means no indent.
729 ** -W|--width NUM Width of lines (default (-1) is to auto-detect).
730 ** Zero means no limit.
731 */
732 void test_comment_format(void){
733 const char *zWidth;
@@ -737,12 +764,12 @@
737 char *zOrigText;
738 int indent, width;
739 int fromFile = find_option("file", 0, 0)!=0;
740 int decode = find_option("decode", 0, 0)!=0;
741 int flags = COMMENT_PRINT_NONE;
742 if( find_option("legacy", 0, 0) ){
743 flags |= COMMENT_PRINT_LEGACY;
744 }
745 if( find_option("trimcrlf", 0, 0) ){
746 flags |= COMMENT_PRINT_TRIM_CRLF;
747 }
748 if( find_option("trimspace", 0, 0) ){
749
--- src/comformat.c
+++ src/comformat.c
@@ -21,18 +21,22 @@
21 #include "config.h"
22 #include "comformat.h"
23 #include <assert.h>
24
25 #if INTERFACE
26 #define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags */
27 #define COMMENT_PRINT_CANONICAL ((u32)0x00000001) /* Use canonical algorithm */
28 #define COMMENT_PRINT_DEFAULT COMMENT_PRINT_CANONICAL /* Default */
29 #define COMMENT_PRINT_UNSET (-1) /* Not initialized */
30
31 /* The canonical comment printing algorithm is recommended. We make
32 ** no promise of on-going support for any of the following flags:
33 */
34 #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
35 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
36 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
37 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
 
 
38 #endif
39
40 /********* Code copied from SQLite src/shell.c.in on 2024-09-30 **********/
41 /* Lookup table to estimate the number of columns consumed by a Unicode
42 ** character.
@@ -483,21 +487,29 @@
487 *pzLine = zLine + index;
488 }
489 }
490
491 /*
492 ** This is the canonical comment printing algorithm. This is the algorithm
493 ** that is recommended and that is used unless the administrator has made
494 ** special arrangements to use a customized algorithm.
495 **
496 ** Given a comment string, format that string for printing on a TTY.
497 ** Assume that the output cursor is indent spaces from the left margin
498 ** and that a single line can contain no more than 'width' characters.
499 ** Indent all subsequent lines by 'indent'.
500 **
501 ** Formatting features:
502 **
503 ** * Leading whitespace is removed.
504 ** * Internal whitespace sequences are changed into a single space (0x20)
505 ** character.
506 ** * Lines are broken at a space, or at a hyphen ("-") whenever possible.
507 **
508 ** Returns the number of new lines emitted.
509 */
510 static int comment_print_canonical(
511 const char *zText, /* The comment text to be printed. */
512 int indent, /* Number of spaces to indent each non-initial line. */
513 int width /* Maximum number of characters per line. */
514 ){
515 int maxChars = width - indent;
@@ -582,13 +594,18 @@
594 ** This is the comment printing function. The comment printing algorithm
595 ** contained within it attempts to preserve the formatting present within
596 ** the comment string itself while honoring line width limitations. There
597 ** are several flags that modify the default behavior of this function:
598 **
599 ** COMMENT_PRINT_CANONICAL: Use the canonical printing algorithm:
600 ** * Omit leading and trailing whitespace
601 ** * Collapse internal whitespace into a
602 ** single space (0x20) character.
603 ** * Attempt to break lines at whitespace
604 ** or hyphens.
605 ** This is the recommended algorithm and is
606 ** used in most cases.
607 **
608 ** COMMENT_PRINT_TRIM_CRLF: Trims leading and trailing carriage-returns
609 ** and line-feeds where they do not materially
610 ** impact pre-existing formatting (i.e. at the
611 ** start of the comment string -AND- right
@@ -631,56 +648,61 @@
648 int indent, /* Spaces to indent each non-initial line. */
649 int width, /* Maximum number of characters per line. */
650 int flags /* Zero or more "COMMENT_PRINT_*" flags. */
651 ){
652 int maxChars = width - indent;
653
654 if( flags & COMMENT_PRINT_CANONICAL ){
655 /* Use the canonical algorithm. This is what happens in almost
656 ** all cases. */
657 return comment_print_canonical(zText, indent, width);
658 }else{
659 /* The remaining is a more complex formatting algorithm that is very
660 ** seldom used and is considered deprecated.
661 */
662 int trimCrLf = flags & COMMENT_PRINT_TRIM_CRLF;
663 int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE;
664 int wordBreak = flags & COMMENT_PRINT_WORD_BREAK;
665 int origBreak = flags & COMMENT_PRINT_ORIG_BREAK;
666 int lineCnt = 0;
667 const char *zLine;
668
669 if( width<0 ){
670 comment_set_maxchars(indent, &maxChars);
671 }
672 if( zText==0 ) zText = "(NULL)";
673 if( maxChars<=0 ){
674 maxChars = strlen(zText);
675 }
676 if( trimSpace ){
677 while( fossil_isspace(zText[0]) ){ zText++; }
678 }
679 if( zText[0]==0 ){
680 fossil_print("\n");
681 lineCnt++;
682 return lineCnt;
683 }
684 zLine = zText;
685 for(;;){
686 comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0,
687 maxChars, trimCrLf, trimSpace, wordBreak, origBreak,
688 &lineCnt, &zLine);
689 if( zLine==0 ) break;
690 while( fossil_isspace(zLine[0]) ) zLine++;
691 if( zLine[0]==0 ) break;
692 }
693 return lineCnt;
694 }
695 }
696
697 /*
698 ** Return the "COMMENT_PRINT_*" flags specified by the following sources,
699 ** evaluated in the following cascading order:
700 **
701 ** 1. The local (per-repository) "comment-format" setting.
702 ** 2. The global (all-repositories) "comment-format" setting.
703 ** 3. The default value COMMENT_PRINT_DEFAULT.
 
704 */
705 int get_comment_format(){
706 int comFmtFlags;
707
708 /* We must cache this result, else running the timeline can end up
@@ -712,22 +734,27 @@
734 ** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?ORIGTEXT?
735 **
736 ** Test comment formatting and printing. Use for testing only.
737 **
738 ** Options:
739 ** --canonical Use the canonical comment printing algorithm:
740 ** * Omit leading/trailing whitespace
741 ** * Collapse internal whitespace into a single
742 ** space character.
743 ** * Attempt to break lines at whitespace or at
744 ** a hyphen.
745 ** --file The comment text is really just a file name to
746 ** read it from
747 ** --decode Decode the text using the same method used when
748 ** handling the value of a C-card from a manifest.
749 ** --indent Number of spaces to indent (default (-1) is to
750 ** auto-detect). Zero means no indent.
751 ** --origbreak Attempt to break when the original comment text
752 ** is detected
753 ** --trimcrlf Enable trimming of leading/trailing CR/LF
754 ** --trimspace Enable trimming of leading/trailing spaces
755 ** --wordbreak Attempt to break lines on word boundaries
 
 
 
 
756 ** -W|--width NUM Width of lines (default (-1) is to auto-detect).
757 ** Zero means no limit.
758 */
759 void test_comment_format(void){
760 const char *zWidth;
@@ -737,12 +764,12 @@
764 char *zOrigText;
765 int indent, width;
766 int fromFile = find_option("file", 0, 0)!=0;
767 int decode = find_option("decode", 0, 0)!=0;
768 int flags = COMMENT_PRINT_NONE;
769 if( find_option("original",0,0) ){
770 flags |= COMMENT_PRINT_CANONICAL;
771 }
772 if( find_option("trimcrlf", 0, 0) ){
773 flags |= COMMENT_PRINT_TRIM_CRLF;
774 }
775 if( find_option("trimspace", 0, 0) ){
776
+8 -11
--- src/db.c
+++ src/db.c
@@ -4640,30 +4640,27 @@
46404640
** When enabled, fossil will attempt to sign all commits
46414641
** with gpg or ssh. When disabled, commits will be unsigned.
46424642
*/
46434643
/*
46444644
** SETTING: comment-format width=16 default=1
4645
-** Set the default options for printing timeline comments to the console.
4646
-**
4647
-** The global --comfmtflags command-line option (or alias --comment-format)
4648
-** overrides this setting.
4645
+** Set the algorithm for printing timeline comments to the console.
46494646
**
46504647
** Possible values are:
4651
-** 1 Activate the legacy comment printing format (default).
4648
+** 1 Use the original comment printing algorithm:
4649
+** * Leading and trialing whitespace is removed
4650
+** * Internal whitespace is converted into a single space (0x20)
4651
+** * Line breaks occurs at whitespace or hyphens if possible
4652
+** This is the recommended value and the default.
46524653
**
46534654
** Or a bitwise combination of the following flags:
4654
-** 0 Activate the newer (non-legacy) comment printing format.
46554655
** 2 Trim leading and trailing CR and LF characters.
46564656
** 4 Trim leading and trailing white space characters.
46574657
** 8 Attempt to break lines on word boundaries.
46584658
** 16 Break lines before the original comment embedded in other text.
46594659
**
4660
-** Note: To preserve line breaks, activate the newer (non-legacy) comment
4661
-** printing format (i.e. set to "0", or a combination not including "1").
4662
-**
4663
-** Note: The options for timeline comments displayed on the web UI can be
4664
-** configured through the /setup_timeline web page.
4660
+** Note: To preserve line breaks and/or other whitespace within comment text,
4661
+** make this setting some integer value that omits the "1" bit.
46654662
*/
46664663
/*
46674664
** SETTING: crlf-glob width=40 versionable block-text
46684665
** The VALUE of this setting is a list of GLOB patterns matching files
46694666
** in which it is allowed to have CR, CR+LF or mixed line endings,
46704667
--- src/db.c
+++ src/db.c
@@ -4640,30 +4640,27 @@
4640 ** When enabled, fossil will attempt to sign all commits
4641 ** with gpg or ssh. When disabled, commits will be unsigned.
4642 */
4643 /*
4644 ** SETTING: comment-format width=16 default=1
4645 ** Set the default options for printing timeline comments to the console.
4646 **
4647 ** The global --comfmtflags command-line option (or alias --comment-format)
4648 ** overrides this setting.
4649 **
4650 ** Possible values are:
4651 ** 1 Activate the legacy comment printing format (default).
 
 
 
 
4652 **
4653 ** Or a bitwise combination of the following flags:
4654 ** 0 Activate the newer (non-legacy) comment printing format.
4655 ** 2 Trim leading and trailing CR and LF characters.
4656 ** 4 Trim leading and trailing white space characters.
4657 ** 8 Attempt to break lines on word boundaries.
4658 ** 16 Break lines before the original comment embedded in other text.
4659 **
4660 ** Note: To preserve line breaks, activate the newer (non-legacy) comment
4661 ** printing format (i.e. set to "0", or a combination not including "1").
4662 **
4663 ** Note: The options for timeline comments displayed on the web UI can be
4664 ** configured through the /setup_timeline web page.
4665 */
4666 /*
4667 ** SETTING: crlf-glob width=40 versionable block-text
4668 ** The VALUE of this setting is a list of GLOB patterns matching files
4669 ** in which it is allowed to have CR, CR+LF or mixed line endings,
4670
--- src/db.c
+++ src/db.c
@@ -4640,30 +4640,27 @@
4640 ** When enabled, fossil will attempt to sign all commits
4641 ** with gpg or ssh. When disabled, commits will be unsigned.
4642 */
4643 /*
4644 ** SETTING: comment-format width=16 default=1
4645 ** Set the algorithm for printing timeline comments to the console.
 
 
 
4646 **
4647 ** Possible values are:
4648 ** 1 Use the original comment printing algorithm:
4649 ** * Leading and trialing whitespace is removed
4650 ** * Internal whitespace is converted into a single space (0x20)
4651 ** * Line breaks occurs at whitespace or hyphens if possible
4652 ** This is the recommended value and the default.
4653 **
4654 ** Or a bitwise combination of the following flags:
 
4655 ** 2 Trim leading and trailing CR and LF characters.
4656 ** 4 Trim leading and trailing white space characters.
4657 ** 8 Attempt to break lines on word boundaries.
4658 ** 16 Break lines before the original comment embedded in other text.
4659 **
4660 ** Note: To preserve line breaks and/or other whitespace within comment text,
4661 ** make this setting some integer value that omits the "1" bit.
 
 
 
4662 */
4663 /*
4664 ** SETTING: crlf-glob width=40 versionable block-text
4665 ** The VALUE of this setting is a list of GLOB patterns matching files
4666 ** in which it is allowed to have CR, CR+LF or mixed line endings,
4667
--- src/dispatch.c
+++ src/dispatch.c
@@ -1357,12 +1357,10 @@
13571357
@
13581358
@ --args FILENAME Read additional arguments and options from FILENAME
13591359
@ --case-sensitive BOOL Set case sensitivity for file names
13601360
@ --cgitrace Active CGI tracing
13611361
@ --chdir PATH Change to PATH before performing any operations
1362
-@ --comfmtflags VALUE Set comment formatting flags to VALUE
1363
-@ --comment-format VALUE Alias for --comfmtflags
13641362
@ --errorlog FILENAME Log errors to FILENAME
13651363
@ --help Show help on the command rather than running it
13661364
@ --httptrace Trace outbound HTTP requests
13671365
@ --localtime Display times using the local timezone
13681366
@ --nocgi Do not act as CGI
13691367
--- src/dispatch.c
+++ src/dispatch.c
@@ -1357,12 +1357,10 @@
1357 @
1358 @ --args FILENAME Read additional arguments and options from FILENAME
1359 @ --case-sensitive BOOL Set case sensitivity for file names
1360 @ --cgitrace Active CGI tracing
1361 @ --chdir PATH Change to PATH before performing any operations
1362 @ --comfmtflags VALUE Set comment formatting flags to VALUE
1363 @ --comment-format VALUE Alias for --comfmtflags
1364 @ --errorlog FILENAME Log errors to FILENAME
1365 @ --help Show help on the command rather than running it
1366 @ --httptrace Trace outbound HTTP requests
1367 @ --localtime Display times using the local timezone
1368 @ --nocgi Do not act as CGI
1369
--- src/dispatch.c
+++ src/dispatch.c
@@ -1357,12 +1357,10 @@
1357 @
1358 @ --args FILENAME Read additional arguments and options from FILENAME
1359 @ --case-sensitive BOOL Set case sensitivity for file names
1360 @ --cgitrace Active CGI tracing
1361 @ --chdir PATH Change to PATH before performing any operations
 
 
1362 @ --errorlog FILENAME Log errors to FILENAME
1363 @ --help Show help on the command rather than running it
1364 @ --httptrace Trace outbound HTTP requests
1365 @ --localtime Display times using the local timezone
1366 @ --nocgi Do not act as CGI
1367
+1 -9
--- src/main.c
+++ src/main.c
@@ -645,19 +645,11 @@
645645
** bitwise flags and initializes the associated global variables. After
646646
** this function executes, all global variables (i.e. in the "g" struct)
647647
** containing option-settable bitwise flag fields must be initialized.
648648
*/
649649
static void fossil_init_flags_from_options(void){
650
- const char *zValue = find_option("comfmtflags", 0, 1);
651
- if( zValue==0 ){
652
- zValue = find_option("comment-format", 0, 1);
653
- }
654
- if( zValue ){
655
- g.comFmtFlags = atoi(zValue);
656
- }else{
657
- g.comFmtFlags = COMMENT_PRINT_UNSET; /* Command-line option not found. */
658
- }
650
+ g.comFmtFlags = COMMENT_PRINT_UNSET; /* Use comment-format flag */
659651
}
660652
661653
/*
662654
** Check to see if the Fossil binary contains an appended repository
663655
** file using the appendvfs extension. If so, change command-line arguments
664656
--- src/main.c
+++ src/main.c
@@ -645,19 +645,11 @@
645 ** bitwise flags and initializes the associated global variables. After
646 ** this function executes, all global variables (i.e. in the "g" struct)
647 ** containing option-settable bitwise flag fields must be initialized.
648 */
649 static void fossil_init_flags_from_options(void){
650 const char *zValue = find_option("comfmtflags", 0, 1);
651 if( zValue==0 ){
652 zValue = find_option("comment-format", 0, 1);
653 }
654 if( zValue ){
655 g.comFmtFlags = atoi(zValue);
656 }else{
657 g.comFmtFlags = COMMENT_PRINT_UNSET; /* Command-line option not found. */
658 }
659 }
660
661 /*
662 ** Check to see if the Fossil binary contains an appended repository
663 ** file using the appendvfs extension. If so, change command-line arguments
664
--- src/main.c
+++ src/main.c
@@ -645,19 +645,11 @@
645 ** bitwise flags and initializes the associated global variables. After
646 ** this function executes, all global variables (i.e. in the "g" struct)
647 ** containing option-settable bitwise flag fields must be initialized.
648 */
649 static void fossil_init_flags_from_options(void){
650 g.comFmtFlags = COMMENT_PRINT_UNSET; /* Use comment-format flag */
 
 
 
 
 
 
 
 
651 }
652
653 /*
654 ** Check to see if the Fossil binary contains an appended repository
655 ** file using the appendvfs extension. If so, change command-line arguments
656

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button