Fossil SCM
Add code to the technote editor so that if some future bug causes it to generate an invalid technote artifact, an error will be generated and the artifact will not be applied to the repository.
Commit
3ee0046529c500d13eca9983248e93b112304810
Parent
c123e3aa075522c…
1 file changed
+8
-1
+8
-1
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -399,11 +399,18 @@ | ||
| 399 | 399 | md5sum_blob(&event, &cksum); |
| 400 | 400 | blob_appendf(&event, "Z %b\n", &cksum); |
| 401 | 401 | blob_reset(&cksum); |
| 402 | 402 | nrid = content_put(&event); |
| 403 | 403 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 404 | - manifest_crosslink(nrid, &event, MC_NONE); | |
| 404 | + if( manifest_crosslink(nrid, &event, MC_NONE)==0 ){ | |
| 405 | + db_end_transaction(1); | |
| 406 | + style_header("Error"); | |
| 407 | + @ Internal error: Fossil tried to make an invalid artifact for | |
| 408 | + @ the edited technode. | |
| 409 | + style_footer(); | |
| 410 | + return; | |
| 411 | + } | |
| 405 | 412 | assert( blob_is_reset(&event) ); |
| 406 | 413 | content_deltify(rid, nrid, 0); |
| 407 | 414 | db_end_transaction(0); |
| 408 | 415 | cgi_redirectf("technote?name=%T", zId); |
| 409 | 416 | } |
| 410 | 417 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -399,11 +399,18 @@ | |
| 399 | md5sum_blob(&event, &cksum); |
| 400 | blob_appendf(&event, "Z %b\n", &cksum); |
| 401 | blob_reset(&cksum); |
| 402 | nrid = content_put(&event); |
| 403 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 404 | manifest_crosslink(nrid, &event, MC_NONE); |
| 405 | assert( blob_is_reset(&event) ); |
| 406 | content_deltify(rid, nrid, 0); |
| 407 | db_end_transaction(0); |
| 408 | cgi_redirectf("technote?name=%T", zId); |
| 409 | } |
| 410 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -399,11 +399,18 @@ | |
| 399 | md5sum_blob(&event, &cksum); |
| 400 | blob_appendf(&event, "Z %b\n", &cksum); |
| 401 | blob_reset(&cksum); |
| 402 | nrid = content_put(&event); |
| 403 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 404 | if( manifest_crosslink(nrid, &event, MC_NONE)==0 ){ |
| 405 | db_end_transaction(1); |
| 406 | style_header("Error"); |
| 407 | @ Internal error: Fossil tried to make an invalid artifact for |
| 408 | @ the edited technode. |
| 409 | style_footer(); |
| 410 | return; |
| 411 | } |
| 412 | assert( blob_is_reset(&event) ); |
| 413 | content_deltify(rid, nrid, 0); |
| 414 | db_end_transaction(0); |
| 415 | cgi_redirectf("technote?name=%T", zId); |
| 416 | } |
| 417 |