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.

stephan 2026-06-24 16:42 UTC trunk
Commit a44ae96c9b4a2fb5e02986dae0a9672d7c7b86240326b2c5443078591e6cfe36
2 files changed +3 -5 +9 -1
+3 -5
--- src/wiki.c
+++ src/wiki.c
@@ -2073,11 +2073,10 @@
20732073
int wiki_cmd_commit(const char *zPageName, int rid, Blob *pContent,
20742074
const char *zMimeType, int localUser){
20752075
Blob wiki; /* Wiki page content */
20762076
Blob cksum; /* wiki checksum */
20772077
char *zDate; /* timestamp */
2078
- char *zUuid; /* uuid for rid */
20792078
20802079
blob_zero(&wiki);
20812080
zDate = date_in_standard_format("now");
20822081
blob_appendf(&wiki, "D %s\n", zDate);
20832082
free(zDate);
@@ -2085,17 +2084,16 @@
20852084
if( zMimeType && *zMimeType
20862085
&& 0!=fossil_strcmp(zMimeType,"text/x-fossil-wiki") ){
20872086
blob_appendf(&wiki, "N %F\n", zMimeType);
20882087
}
20892088
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);
20932091
}
20942092
user_select();
20952093
if( !login_is_nobody() ){
2096
- blob_appendf(&wiki, "U %F\n", login_name());
2094
+ blob_appendf(&wiki, "U %F\n", login_name());
20972095
}
20982096
blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent),
20992097
blob_str(pContent) );
21002098
md5sum_blob(&wiki, &cksum);
21012099
blob_appendf(&wiki, "Z %b\n", &cksum);
21022100
--- 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
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -369,16 +369,24 @@
369369
extra newline.
370370
371371
The <b>C</b> card on a wiki page is optional. The argument is a comment
372372
that explains why the changes were made. The ability to have a <b>C</b>
373373
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
375375
implementation. Older versions of Fossil will reject a wiki-page
376376
artifact that includes a <b>C</b> card.
377377
378378
An example wiki artifact can be seen
379379
[/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>.
380388
381389
<h3 id="tktchng">2.5 Ticket Changes</h3>
382390
383391
A ticket-change artifact represents a change to a trouble ticket.
384392
The following cards are allowed on a ticket change artifact:
385393
--- 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

Keyboard Shortcuts

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