Fossil SCM
Document that the C-card in events is optional. Proof: [bfdf42305400f6ca]. Don't output C-card in events when not necessary (code copied from attach.c)
Commit
6a03e9329bbf3369a0ee64dd6fe94dfd4b5a3b8e
Parent
16f033dda310214…
2 files changed
+7
-2
+2
-2
+7
-2
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -280,15 +280,20 @@ | ||
| 280 | 280 | } |
| 281 | 281 | zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime); |
| 282 | 282 | if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){ |
| 283 | 283 | char *zDate; |
| 284 | 284 | Blob cksum; |
| 285 | - int nrid; | |
| 285 | + int nrid, n; | |
| 286 | 286 | blob_zero(&event); |
| 287 | 287 | db_begin_transaction(); |
| 288 | 288 | login_verify_csrf_secret(); |
| 289 | - blob_appendf(&event, "C %F\n", zComment); | |
| 289 | + while( fossil_isspace(zComment[0]) ) zComment++; | |
| 290 | + n = strlen(zComment); | |
| 291 | + while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; } | |
| 292 | + if( n>0 ){ | |
| 293 | + blob_appendf(&event, "C %F\n", zComment); | |
| 294 | + } | |
| 290 | 295 | zDate = date_in_standard_format("now"); |
| 291 | 296 | blob_appendf(&event, "D %s\n", zDate); |
| 292 | 297 | free(zDate); |
| 293 | 298 | zETime[10] = 'T'; |
| 294 | 299 | blob_appendf(&event, "E %s %s\n", zETime, zEventId); |
| 295 | 300 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -280,15 +280,20 @@ | |
| 280 | } |
| 281 | zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime); |
| 282 | if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){ |
| 283 | char *zDate; |
| 284 | Blob cksum; |
| 285 | int nrid; |
| 286 | blob_zero(&event); |
| 287 | db_begin_transaction(); |
| 288 | login_verify_csrf_secret(); |
| 289 | blob_appendf(&event, "C %F\n", zComment); |
| 290 | zDate = date_in_standard_format("now"); |
| 291 | blob_appendf(&event, "D %s\n", zDate); |
| 292 | free(zDate); |
| 293 | zETime[10] = 'T'; |
| 294 | blob_appendf(&event, "E %s %s\n", zETime, zEventId); |
| 295 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -280,15 +280,20 @@ | |
| 280 | } |
| 281 | zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime); |
| 282 | if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){ |
| 283 | char *zDate; |
| 284 | Blob cksum; |
| 285 | int nrid, n; |
| 286 | blob_zero(&event); |
| 287 | db_begin_transaction(); |
| 288 | login_verify_csrf_secret(); |
| 289 | while( fossil_isspace(zComment[0]) ) zComment++; |
| 290 | n = strlen(zComment); |
| 291 | while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; } |
| 292 | if( n>0 ){ |
| 293 | blob_appendf(&event, "C %F\n", zComment); |
| 294 | } |
| 295 | zDate = date_in_standard_format("now"); |
| 296 | blob_appendf(&event, "D %s\n", zDate); |
| 297 | free(zDate); |
| 298 | zETime[10] = 'T'; |
| 299 | blob_appendf(&event, "E %s %s\n", zETime, zEventId); |
| 300 |
+2
-2
| --- www/fileformat.wiki | ||
| +++ www/fileformat.wiki | ||
| @@ -482,11 +482,11 @@ | ||
| 482 | 482 | <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> |
| 483 | 483 | <b>Z</b> <i>checksum</i> |
| 484 | 484 | </blockquote> |
| 485 | 485 | |
| 486 | 486 | The C card contains text that is displayed on the timeline for the |
| 487 | -event. Exactly one C card is required on an event artifact. | |
| 487 | +event. The C card is optional, but there can only be one. | |
| 488 | 488 | |
| 489 | 489 | A single D card is required to give the date and time when the |
| 490 | 490 | event artifact was created. This is different from the time at which |
| 491 | 491 | the event occurs. |
| 492 | 492 | |
| @@ -581,11 +581,11 @@ | ||
| 581 | 581 | <td> </td> |
| 582 | 582 | <td> </td> |
| 583 | 583 | <td> </td> |
| 584 | 584 | <td> </td> |
| 585 | 585 | <td align=center><b>0-1</b></td> |
| 586 | -<td align=center><b>1</b></td> | |
| 586 | +<td align=center><b>0-1</b></td> | |
| 587 | 587 | </tr> |
| 588 | 588 | <tr> |
| 589 | 589 | <td><b>D</b> <i>date-time-stamp</i></td> |
| 590 | 590 | <td align=center><b>1</b></td> |
| 591 | 591 | <td align=center> </td> |
| 592 | 592 |
| --- www/fileformat.wiki | |
| +++ www/fileformat.wiki | |
| @@ -482,11 +482,11 @@ | |
| 482 | <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> |
| 483 | <b>Z</b> <i>checksum</i> |
| 484 | </blockquote> |
| 485 | |
| 486 | The C card contains text that is displayed on the timeline for the |
| 487 | event. Exactly one C card is required on an event artifact. |
| 488 | |
| 489 | A single D card is required to give the date and time when the |
| 490 | event artifact was created. This is different from the time at which |
| 491 | the event occurs. |
| 492 | |
| @@ -581,11 +581,11 @@ | |
| 581 | <td> </td> |
| 582 | <td> </td> |
| 583 | <td> </td> |
| 584 | <td> </td> |
| 585 | <td align=center><b>0-1</b></td> |
| 586 | <td align=center><b>1</b></td> |
| 587 | </tr> |
| 588 | <tr> |
| 589 | <td><b>D</b> <i>date-time-stamp</i></td> |
| 590 | <td align=center><b>1</b></td> |
| 591 | <td align=center> </td> |
| 592 |
| --- www/fileformat.wiki | |
| +++ www/fileformat.wiki | |
| @@ -482,11 +482,11 @@ | |
| 482 | <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> |
| 483 | <b>Z</b> <i>checksum</i> |
| 484 | </blockquote> |
| 485 | |
| 486 | The C card contains text that is displayed on the timeline for the |
| 487 | event. The C card is optional, but there can only be one. |
| 488 | |
| 489 | A single D card is required to give the date and time when the |
| 490 | event artifact was created. This is different from the time at which |
| 491 | the event occurs. |
| 492 | |
| @@ -581,11 +581,11 @@ | |
| 581 | <td> </td> |
| 582 | <td> </td> |
| 583 | <td> </td> |
| 584 | <td> </td> |
| 585 | <td align=center><b>0-1</b></td> |
| 586 | <td align=center><b>0-1</b></td> |
| 587 | </tr> |
| 588 | <tr> |
| 589 | <td><b>D</b> <i>date-time-stamp</i></td> |
| 590 | <td align=center><b>1</b></td> |
| 591 | <td align=center> </td> |
| 592 |