Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Simplify the verify-comments setting to have just "on", "off", and "preview" options. Rename the function that implements this feature to "verify_comment()". Reimplement that function so that it uses the new error reporting mechanism in wiki_convert(). |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
072125b0ecd047c9184ae83f0974065d |
| User & Date: | drh 2025-03-22 09:38:45.039 |
Context
|
2025-03-22
| ||
| 10:38 | Delete the timeline-block-markup setting, and all the complication that goes with it. Due to a bug [/info/2020-06-02T17:38z|introduced on 2020-06-02], Fossil has behaved as if that setting where always "on", regardless of its actual value, and nobody has complained. Hence, we surmise that the setting is not needed. Ref: [forum:/forumpost/9adfe7e46b2441ae|forum post 9adfe7e46b2] check-in: 0432c38df6 user: drh tags: trunk | |
| 09:38 | Simplify the verify-comments setting to have just "on", "off", and "preview" options. Rename the function that implements this feature to "verify_comment()". Reimplement that function so that it uses the new error reporting mechanism in wiki_convert(). check-in: 072125b0ec user: drh tags: trunk | |
|
2025-03-21
| ||
| 23:29 | Work around missing BIO_set_conn_ip_family() API in LibreSSL. This fixes [forum:/forumpost/a52cbed8f228397e|forum post a52cbed8f], I'm told. check-in: 50ff741f6f user: drh tags: trunk | |
Changes
Changes to src/checkin.c.
| ︙ | ︙ | |||
2287 2288 2289 2290 2291 2292 2293 | /* ** SETTING: verify-comments width=8 default=on ** ** This setting determines how much sanity checking, if any, the ** "fossil commit" and "fossil amend" commands do against check-in ** comments. Recognized values: ** | | | | | | < < | | > | < | | < | > | | | | < < < < | | < | | | < < < < < < < < < < < < < < < < < < < < < < < < | < < | < | | | < | | | < > > < < < < | < < < < < < < | < < < < < < < < < < < < < < < < < | | | | | < > | | < | > | | 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 |
/*
** SETTING: verify-comments width=8 default=on
**
** This setting determines how much sanity checking, if any, the
** "fossil commit" and "fossil amend" commands do against check-in
** comments. Recognized values:
**
** on (Default) Check for bad syntax and/or broken hyperlinks
** in check-in comments and offer the user a chance to
** continue editing for interactive sessions, or simply
** abort the commit if the comment was entered using -m or -M
**
** off Do not do syntax checking of any kind
**
** preview Do all the same checks as "on" but also always preview the
** check-in comment to the user during interactive sessions
** even if no obvious errors are found, and provide an
** opportunity to accept or re-edit
*/
#if INTERFACE
#define COMCK_MARKUP 0x01 /* Check for mistakes */
#define COMCK_PREVIEW 0x02 /* Always preview, even if no issues found */
#endif /* INTERFACE */
/*
** Check for possible formatting errors in the comment string pComment.
**
** If issues are found, write an appropriate error notice, probably also
** including the complete text of the comment formatted to highlight the
** problem, to stdout and return non-zero. The return value is some
** combination of the COMCK_* flags, depending on what went wrong.
**
** If no issues are seen, do not output anything and return zero.
*/
int verify_comment(Blob *pComment, int mFlags){
Blob in, html;
int mResult;
int rc = mFlags & COMCK_PREVIEW;
int wFlags;
if( mFlags==0 ) return 0;
blob_init(&in, blob_str(pComment), -1);
blob_init(&html, 0, 0);
wFlags = wiki_convert_flags(0);
wFlags &= WIKI_NOBADLINKS;
wFlags |= WIKI_MARK;
mResult = wiki_convert(&in, &html, wFlags);
if( mResult & RENDER_ANYERROR ) rc |= COMCK_MARKUP;
if( rc ){
int htot = HTOT_NO_WS;
Blob txt;
if( terminal_is_vt100() ) htot |= HTOT_VT100;
blob_init(&txt, 0, 0);
html_to_plaintext(blob_str(&html), &txt, htot);
if( rc & COMCK_MARKUP ){
fossil_print("Possible format errors in the check-in comment:\n\n ");
}else{
fossil_print("Preview of the check-in comment:\n\n ");
}
comment_print(blob_str(&txt), 0, 3, -1, get_comment_format());
fossil_print("\n");
fflush(stdout);
blob_reset(&txt);
}
blob_reset(&html);
blob_reset(&in);
return rc;
}
/*
** COMMAND: ci#
** COMMAND: commit
**
** Usage: %fossil commit ?OPTIONS? ?FILE...?
** or: %fossil ci ?OPTIONS? ?FILE...?
|
| ︙ | ︙ | |||
2554 2555 2556 2557 2558 2559 2560 | Blob ans; /* Answer to continuation prompts */ char cReply; /* First character of ans */ int bRecheck = 0; /* Repeat fork and closed-branch checks*/ int bIgnoreSkew = 0; /* --ignore-clock-skew flag */ int mxSize; char *zCurBranch = 0; /* The current branch name of checkout */ char *zNewBranch = 0; /* The branch name after update */ | | | 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 |
Blob ans; /* Answer to continuation prompts */
char cReply; /* First character of ans */
int bRecheck = 0; /* Repeat fork and closed-branch checks*/
int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
int mxSize;
char *zCurBranch = 0; /* The current branch name of checkout */
char *zNewBranch = 0; /* The branch name after update */
int ckComFlgs; /* Flags passed to verify_comment() */
memset(&sCiInfo, 0, sizeof(sCiInfo));
url_proxy_options();
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
noSign = find_option("nosign",0,0)!=0;
if( find_option("nosync",0,0) ) g.fNoSync = 1;
|
| ︙ | ︙ | |||
2926 2927 2928 2929 2930 2931 2932 |
if( noVerifyCom ){
ckComFlgs = 0;
}else{
const char *zVerComs = db_get("verify-comments","on");
if( is_false(zVerComs) ){
ckComFlgs = 0;
}else if( strcmp(zVerComs,"preview")==0 ){
| | < < | | < | | < | | | | | | | 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 |
if( noVerifyCom ){
ckComFlgs = 0;
}else{
const char *zVerComs = db_get("verify-comments","on");
if( is_false(zVerComs) ){
ckComFlgs = 0;
}else if( strcmp(zVerComs,"preview")==0 ){
ckComFlgs = COMCK_PREVIEW | COMCK_MARKUP;
}else{
ckComFlgs = COMCK_MARKUP;
}
}
/* Get the check-in comment. This might involve prompting the
** user for the check-in comment, in which case we should resync
** to renew the check-in lock and repeat the checks for conflicts.
*/
if( zComment ){
blob_zero(&comment);
blob_append(&comment, zComment, -1);
ckComFlgs &= ~COMCK_PREVIEW;
if( verify_comment(&comment, ckComFlgs) ){
fossil_fatal("Commit aborted; "
"use --no-verify-comment to override");
}
}else if( zComFile ){
blob_zero(&comment);
blob_read_from_file(&comment, zComFile, ExtFILE);
blob_to_utf8_no_bom(&comment, 1);
ckComFlgs &= ~COMCK_PREVIEW;
if( verify_comment(&comment, ckComFlgs) ){
fossil_fatal("Commit aborted; "
"use --no-verify-comment to override");
}
}else if( !noPrompt ){
while( 1/*exit-by-break*/ ){
int rc;
char *zInit;
zInit = db_text(0,"SELECT value FROM vvar WHERE name='ci-comment'");
prepare_commit_comment(&comment, zInit, &sCiInfo, vid, dryRunFlag);
db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
if( (rc = verify_comment(&comment, ckComFlgs))!=0 ){
if( rc==COMCK_PREVIEW ){
prompt_user("Continue, abort, or edit? (C/a/e)? ", &ans);
}else{
prompt_user("Edit, abort, or continue (E/a/c)? ", &ans);
}
cReply = blob_str(&ans)[0];
cReply = fossil_tolower(cReply);
blob_reset(&ans);
if( cReply=='a' ){
fossil_fatal("Commit aborted.");
}
if( cReply=='e' || (cReply!='c' && rc!=COMCK_PREVIEW) ){
fossil_free(zInit);
continue;
}
}
if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
3935 3936 3937 3938 3939 3940 3941 | const char *zUuid; Blob ctrl; Blob comment; char *zNow; int nTags, nCancels; int i; Stmt q; | | | 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 |
const char *zUuid;
Blob ctrl;
Blob comment;
char *zNow;
int nTags, nCancels;
int i;
Stmt q;
int ckComFlgs; /* Flags passed to verify_comment() */
fEditComment = find_option("edit-comment","e",0)!=0;
zNewComment = find_option("comment","m",1);
zComFile = find_option("message-file","M",1);
zNewBranch = find_option("branch",0,1);
zNewColor = find_option("bgcolor",0,1);
|
| ︙ | ︙ | |||
4028 4029 4030 4031 4032 4033 4034 |
if( noVerifyCom ){
ckComFlgs = 0;
}else{
const char *zVerComs = db_get("verify-comments","on");
if( is_false(zVerComs) ){
ckComFlgs = 0;
}else if( strcmp(zVerComs,"preview")==0 ){
| | < < | < < < | | | | | | 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 |
if( noVerifyCom ){
ckComFlgs = 0;
}else{
const char *zVerComs = db_get("verify-comments","on");
if( is_false(zVerComs) ){
ckComFlgs = 0;
}else if( strcmp(zVerComs,"preview")==0 ){
ckComFlgs = COMCK_PREVIEW | COMCK_MARKUP;
}else{
ckComFlgs = COMCK_MARKUP;
}
}
if( fEditComment ){
prepare_amend_comment(&comment, zComment, zUuid);
}else if( zComFile ){
blob_read_from_file(&comment, zComFile, ExtFILE);
blob_to_utf8_no_bom(&comment, 1);
}else if( zNewComment ){
blob_init(&comment, zNewComment, -1);
}
if( blob_size(&comment)>0
&& comment_compare(zComment, blob_str(&comment))==0
){
int rc;
while( (rc = verify_comment(&comment, ckComFlgs))!=0 ){
char cReply;
Blob ans;
if( !fEditComment ){
fossil_fatal("Amend aborted; "
"use --no-verify-comment to override");
}
if( rc==COMCK_PREVIEW ){
prompt_user("Continue, abort, or edit (C/a/e)? ", &ans);
}else{
prompt_user("Edit, abort, or continue (E/a/c)? ", &ans);
}
cReply = blob_str(&ans)[0];
cReply = fossil_tolower(cReply);
blob_reset(&ans);
if( cReply=='a' ){
fossil_fatal("Amend aborted.");
}
if( cReply=='e' || (cReply!='c' && rc!=COMCK_PREVIEW) ){
char *zPrior = blob_materialize(&comment);
blob_init(&comment, 0, 0);
prepare_amend_comment(&comment, zPrior, zUuid);
fossil_free(zPrior);
continue;
}else{
break;
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
273 274 275 276 277 278 279 | ** configuration parameters. ** ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2 ** flags) and is false for plain "%W". The ! indicates that the text is ** to be rendered on a form rather than the timeline and that block markup ** is acceptable even if the "timeline-block-markup" setting is false. */ | | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
** configuration parameters.
**
** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
** flags) and is false for plain "%W". The ! indicates that the text is
** to be rendered on a form rather than the timeline and that block markup
** is acceptable even if the "timeline-block-markup" setting is false.
*/
int wiki_convert_flags(int altForm2){
static int wikiFlags = 0;
if( wikiFlags==0 ){
if( db_get_boolean("timeline-block-markup", 0) ){
wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
}else{
wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
}
|
| ︙ | ︙ |