Fossil SCM
In "fossil rebuild" and "fossil deconstruct", leave an artifact alone when its content cannot be rebuilt because it is a delta from something that has not arrived. Rebuild recorded its size as zero, which stayed wrong after the source arrived, and deconstruct wrote an empty file.
Commit
2c2b6af037bb4f048976286fbb7eb5b16895bc9493d8615ca1e118f8a25269ff
Parent
4af860df3834d77…
1 file changed
+12
-4
+12
-4
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -465,12 +465,16 @@ | ||
| 465 | 465 | int rid = db_column_int(&s, 0); |
| 466 | 466 | int size = db_column_int(&s, 1); |
| 467 | 467 | if( size>=0 ){ |
| 468 | 468 | if( !bag_find(&bagDone, rid) ){ |
| 469 | 469 | Blob content; |
| 470 | - content_get(rid, &content); | |
| 471 | - rebuild_step(rid, size, &content); | |
| 470 | + if( content_get(rid, &content) ){ | |
| 471 | + rebuild_step(rid, size, &content); | |
| 472 | + }else{ | |
| 473 | + /* The content cannot be rebuilt. Leave the artifact as it is. */ | |
| 474 | + rebuild_step_done(rid); | |
| 475 | + } | |
| 472 | 476 | } |
| 473 | 477 | }else{ |
| 474 | 478 | db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid); |
| 475 | 479 | rebuild_step_done(rid); |
| 476 | 480 | } |
| @@ -1527,12 +1531,16 @@ | ||
| 1527 | 1531 | int rid = db_column_int(&s, 0); |
| 1528 | 1532 | int size = db_column_int(&s, 1); |
| 1529 | 1533 | if( size>=0 ){ |
| 1530 | 1534 | if( !bag_find(&bagDone, rid) ){ |
| 1531 | 1535 | Blob content; |
| 1532 | - content_get(rid, &content); | |
| 1533 | - rebuild_step(rid, size, &content); | |
| 1536 | + if( content_get(rid, &content) ){ | |
| 1537 | + rebuild_step(rid, size, &content); | |
| 1538 | + }else{ | |
| 1539 | + /* The content cannot be rebuilt. Leave the artifact as it is. */ | |
| 1540 | + rebuild_step_done(rid); | |
| 1541 | + } | |
| 1534 | 1542 | } |
| 1535 | 1543 | } |
| 1536 | 1544 | } |
| 1537 | 1545 | db_finalize(&s); |
| 1538 | 1546 | |
| 1539 | 1547 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -465,12 +465,16 @@ | |
| 465 | int rid = db_column_int(&s, 0); |
| 466 | int size = db_column_int(&s, 1); |
| 467 | if( size>=0 ){ |
| 468 | if( !bag_find(&bagDone, rid) ){ |
| 469 | Blob content; |
| 470 | content_get(rid, &content); |
| 471 | rebuild_step(rid, size, &content); |
| 472 | } |
| 473 | }else{ |
| 474 | db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid); |
| 475 | rebuild_step_done(rid); |
| 476 | } |
| @@ -1527,12 +1531,16 @@ | |
| 1527 | int rid = db_column_int(&s, 0); |
| 1528 | int size = db_column_int(&s, 1); |
| 1529 | if( size>=0 ){ |
| 1530 | if( !bag_find(&bagDone, rid) ){ |
| 1531 | Blob content; |
| 1532 | content_get(rid, &content); |
| 1533 | rebuild_step(rid, size, &content); |
| 1534 | } |
| 1535 | } |
| 1536 | } |
| 1537 | db_finalize(&s); |
| 1538 | |
| 1539 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -465,12 +465,16 @@ | |
| 465 | int rid = db_column_int(&s, 0); |
| 466 | int size = db_column_int(&s, 1); |
| 467 | if( size>=0 ){ |
| 468 | if( !bag_find(&bagDone, rid) ){ |
| 469 | Blob content; |
| 470 | if( content_get(rid, &content) ){ |
| 471 | rebuild_step(rid, size, &content); |
| 472 | }else{ |
| 473 | /* The content cannot be rebuilt. Leave the artifact as it is. */ |
| 474 | rebuild_step_done(rid); |
| 475 | } |
| 476 | } |
| 477 | }else{ |
| 478 | db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid); |
| 479 | rebuild_step_done(rid); |
| 480 | } |
| @@ -1527,12 +1531,16 @@ | |
| 1531 | int rid = db_column_int(&s, 0); |
| 1532 | int size = db_column_int(&s, 1); |
| 1533 | if( size>=0 ){ |
| 1534 | if( !bag_find(&bagDone, rid) ){ |
| 1535 | Blob content; |
| 1536 | if( content_get(rid, &content) ){ |
| 1537 | rebuild_step(rid, size, &content); |
| 1538 | }else{ |
| 1539 | /* The content cannot be rebuilt. Leave the artifact as it is. */ |
| 1540 | rebuild_step_done(rid); |
| 1541 | } |
| 1542 | } |
| 1543 | } |
| 1544 | } |
| 1545 | db_finalize(&s); |
| 1546 | |
| 1547 |