Fossil SCM
Replace an ad-hoc query with rid_to_uuid(). Add a note about fossil historically eliding the U-card on wiki edits made by 'nobody', which isn't spec-legal but is an age-old practice.
Commit
a44ae96c9b4a2fb5e02986dae0a9672d7c7b86240326b2c5443078591e6cfe36
Parent
3c8de67618e6557…
2 files changed
+3
-5
+9
-1
+3
-5
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -2073,11 +2073,10 @@ | ||
| 2073 | 2073 | int wiki_cmd_commit(const char *zPageName, int rid, Blob *pContent, |
| 2074 | 2074 | const char *zMimeType, int localUser){ |
| 2075 | 2075 | Blob wiki; /* Wiki page content */ |
| 2076 | 2076 | Blob cksum; /* wiki checksum */ |
| 2077 | 2077 | char *zDate; /* timestamp */ |
| 2078 | - char *zUuid; /* uuid for rid */ | |
| 2079 | 2078 | |
| 2080 | 2079 | blob_zero(&wiki); |
| 2081 | 2080 | zDate = date_in_standard_format("now"); |
| 2082 | 2081 | blob_appendf(&wiki, "D %s\n", zDate); |
| 2083 | 2082 | free(zDate); |
| @@ -2085,17 +2084,16 @@ | ||
| 2085 | 2084 | if( zMimeType && *zMimeType |
| 2086 | 2085 | && 0!=fossil_strcmp(zMimeType,"text/x-fossil-wiki") ){ |
| 2087 | 2086 | blob_appendf(&wiki, "N %F\n", zMimeType); |
| 2088 | 2087 | } |
| 2089 | 2088 | if( rid ){ |
| 2090 | - zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); | |
| 2091 | - blob_appendf(&wiki, "P %s\n", zUuid); | |
| 2092 | - free(zUuid); | |
| 2089 | + char *zUuid = rid_to_uuid(rid); | |
| 2090 | + blob_appendf(&wiki, "P %z\n", zUuid); | |
| 2093 | 2091 | } |
| 2094 | 2092 | user_select(); |
| 2095 | 2093 | if( !login_is_nobody() ){ |
| 2096 | - blob_appendf(&wiki, "U %F\n", login_name()); | |
| 2094 | + blob_appendf(&wiki, "U %F\n", login_name()); | |
| 2097 | 2095 | } |
| 2098 | 2096 | blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent), |
| 2099 | 2097 | blob_str(pContent) ); |
| 2100 | 2098 | md5sum_blob(&wiki, &cksum); |
| 2101 | 2099 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 2102 | 2100 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -2073,11 +2073,10 @@ | |
| 2073 | int wiki_cmd_commit(const char *zPageName, int rid, Blob *pContent, |
| 2074 | const char *zMimeType, int localUser){ |
| 2075 | Blob wiki; /* Wiki page content */ |
| 2076 | Blob cksum; /* wiki checksum */ |
| 2077 | char *zDate; /* timestamp */ |
| 2078 | char *zUuid; /* uuid for rid */ |
| 2079 | |
| 2080 | blob_zero(&wiki); |
| 2081 | zDate = date_in_standard_format("now"); |
| 2082 | blob_appendf(&wiki, "D %s\n", zDate); |
| 2083 | free(zDate); |
| @@ -2085,17 +2084,16 @@ | |
| 2085 | if( zMimeType && *zMimeType |
| 2086 | && 0!=fossil_strcmp(zMimeType,"text/x-fossil-wiki") ){ |
| 2087 | blob_appendf(&wiki, "N %F\n", zMimeType); |
| 2088 | } |
| 2089 | if( rid ){ |
| 2090 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 2091 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 2092 | free(zUuid); |
| 2093 | } |
| 2094 | user_select(); |
| 2095 | if( !login_is_nobody() ){ |
| 2096 | blob_appendf(&wiki, "U %F\n", login_name()); |
| 2097 | } |
| 2098 | blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent), |
| 2099 | blob_str(pContent) ); |
| 2100 | md5sum_blob(&wiki, &cksum); |
| 2101 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 2102 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -2073,11 +2073,10 @@ | |
| 2073 | int wiki_cmd_commit(const char *zPageName, int rid, Blob *pContent, |
| 2074 | const char *zMimeType, int localUser){ |
| 2075 | Blob wiki; /* Wiki page content */ |
| 2076 | Blob cksum; /* wiki checksum */ |
| 2077 | char *zDate; /* timestamp */ |
| 2078 | |
| 2079 | blob_zero(&wiki); |
| 2080 | zDate = date_in_standard_format("now"); |
| 2081 | blob_appendf(&wiki, "D %s\n", zDate); |
| 2082 | free(zDate); |
| @@ -2085,17 +2084,16 @@ | |
| 2084 | if( zMimeType && *zMimeType |
| 2085 | && 0!=fossil_strcmp(zMimeType,"text/x-fossil-wiki") ){ |
| 2086 | blob_appendf(&wiki, "N %F\n", zMimeType); |
| 2087 | } |
| 2088 | if( rid ){ |
| 2089 | char *zUuid = rid_to_uuid(rid); |
| 2090 | blob_appendf(&wiki, "P %z\n", zUuid); |
| 2091 | } |
| 2092 | user_select(); |
| 2093 | if( !login_is_nobody() ){ |
| 2094 | blob_appendf(&wiki, "U %F\n", login_name()); |
| 2095 | } |
| 2096 | blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent), |
| 2097 | blob_str(pContent) ); |
| 2098 | md5sum_blob(&wiki, &cksum); |
| 2099 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 2100 |
+9
-1
| --- www/fileformat.wiki | ||
| +++ www/fileformat.wiki | ||
| @@ -369,16 +369,24 @@ | ||
| 369 | 369 | extra newline. |
| 370 | 370 | |
| 371 | 371 | The <b>C</b> card on a wiki page is optional. The argument is a comment |
| 372 | 372 | that explains why the changes were made. The ability to have a <b>C</b> |
| 373 | 373 | card on a wiki page artifact was added on 2019-12-02 at the suggestion |
| 374 | -of user George Krivov and is not currently used or generated by the | |
| 374 | +of user George Krivov and is not currently used or generated by the | |
| 375 | 375 | implementation. Older versions of Fossil will reject a wiki-page |
| 376 | 376 | artifact that includes a <b>C</b> card. |
| 377 | 377 | |
| 378 | 378 | An example wiki artifact can be seen |
| 379 | 379 | [/artifact?name=7b2f5fd0e0&txt=1 | here]. |
| 380 | + | |
| 381 | +Historical note: though <b>U</b> cards are technically required for | |
| 382 | +wiki pages by this specification, Fossil has historically elided them | |
| 383 | +if the submitter is "nobody". Very few repositories enable "nobody" to | |
| 384 | +write to wiki pages, so relatively few wiki artifacts without U cards | |
| 385 | +exist, but they do exist. Implementations are recommended to accept a | |
| 386 | +missing U card as an alias for a U card with the value | |
| 387 | +<tt>nobody</tt>. | |
| 380 | 388 | |
| 381 | 389 | <h3 id="tktchng">2.5 Ticket Changes</h3> |
| 382 | 390 | |
| 383 | 391 | A ticket-change artifact represents a change to a trouble ticket. |
| 384 | 392 | The following cards are allowed on a ticket change artifact: |
| 385 | 393 |
| --- www/fileformat.wiki | |
| +++ www/fileformat.wiki | |
| @@ -369,16 +369,24 @@ | |
| 369 | extra newline. |
| 370 | |
| 371 | The <b>C</b> card on a wiki page is optional. The argument is a comment |
| 372 | that explains why the changes were made. The ability to have a <b>C</b> |
| 373 | card on a wiki page artifact was added on 2019-12-02 at the suggestion |
| 374 | of user George Krivov and is not currently used or generated by the |
| 375 | implementation. Older versions of Fossil will reject a wiki-page |
| 376 | artifact that includes a <b>C</b> card. |
| 377 | |
| 378 | An example wiki artifact can be seen |
| 379 | [/artifact?name=7b2f5fd0e0&txt=1 | here]. |
| 380 | |
| 381 | <h3 id="tktchng">2.5 Ticket Changes</h3> |
| 382 | |
| 383 | A ticket-change artifact represents a change to a trouble ticket. |
| 384 | The following cards are allowed on a ticket change artifact: |
| 385 |
| --- www/fileformat.wiki | |
| +++ www/fileformat.wiki | |
| @@ -369,16 +369,24 @@ | |
| 369 | extra newline. |
| 370 | |
| 371 | The <b>C</b> card on a wiki page is optional. The argument is a comment |
| 372 | that explains why the changes were made. The ability to have a <b>C</b> |
| 373 | card on a wiki page artifact was added on 2019-12-02 at the suggestion |
| 374 | of user George Krivov and is not currently used or generated by the |
| 375 | implementation. Older versions of Fossil will reject a wiki-page |
| 376 | artifact that includes a <b>C</b> card. |
| 377 | |
| 378 | An example wiki artifact can be seen |
| 379 | [/artifact?name=7b2f5fd0e0&txt=1 | here]. |
| 380 | |
| 381 | Historical note: though <b>U</b> cards are technically required for |
| 382 | wiki pages by this specification, Fossil has historically elided them |
| 383 | if the submitter is "nobody". Very few repositories enable "nobody" to |
| 384 | write to wiki pages, so relatively few wiki artifacts without U cards |
| 385 | exist, but they do exist. Implementations are recommended to accept a |
| 386 | missing U card as an alias for a U card with the value |
| 387 | <tt>nobody</tt>. |
| 388 | |
| 389 | <h3 id="tktchng">2.5 Ticket Changes</h3> |
| 390 | |
| 391 | A ticket-change artifact represents a change to a trouble ticket. |
| 392 | The following cards are allowed on a ticket change artifact: |
| 393 |