Fossil SCM
Some corrections to ticket hook logic.
Commit
a6faa2aee488d538566c4380ee14dacc1e7dd43c
Parent
dff7d2c1ee2089f…
1 file changed
+8
-5
+8
-5
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1497,21 +1497,24 @@ | ||
| 1497 | 1497 | ** Finish up a sequence of manifest_crosslink calls. |
| 1498 | 1498 | */ |
| 1499 | 1499 | int manifest_crosslink_end(int flags){ |
| 1500 | 1500 | Stmt q, u; |
| 1501 | 1501 | int i; |
| 1502 | - int rc = TH_ERROR; | |
| 1502 | + int rc = TH_OK; | |
| 1503 | + int permitHooks = (flags & MC_PERMIT_HOOKS); | |
| 1504 | + const char *zScript = 0; | |
| 1503 | 1505 | assert( manifest_crosslink_busy==1 ); |
| 1504 | - if( flags&MC_PERMIT_HOOKS ){ | |
| 1506 | + zScript = xfer_ticket_code(); | |
| 1507 | + if( zScript && permitHooks ){ | |
| 1505 | 1508 | rc = xfer_run_common_script(); |
| 1506 | 1509 | } |
| 1507 | 1510 | db_prepare(&q, "SELECT uuid FROM pending_tkt"); |
| 1508 | 1511 | while( db_step(&q)==SQLITE_ROW ){ |
| 1509 | 1512 | const char *zUuid = db_column_text(&q, 0); |
| 1510 | 1513 | ticket_rebuild_entry(zUuid); |
| 1511 | - if( rc==TH_OK ){ | |
| 1512 | - rc = xfer_run_script(xfer_ticket_code(), zUuid); | |
| 1514 | + if( rc==TH_OK && zScript && permitHooks ){ | |
| 1515 | + rc = xfer_run_script(zScript, zUuid); | |
| 1513 | 1516 | } |
| 1514 | 1517 | } |
| 1515 | 1518 | db_finalize(&q); |
| 1516 | 1519 | db_multi_exec("DROP TABLE pending_tkt"); |
| 1517 | 1520 | |
| @@ -1543,11 +1546,11 @@ | ||
| 1543 | 1546 | "DROP TABLE time_fudge;" |
| 1544 | 1547 | ); |
| 1545 | 1548 | |
| 1546 | 1549 | db_end_transaction(0); |
| 1547 | 1550 | manifest_crosslink_busy = 0; |
| 1548 | - return rc; | |
| 1551 | + return ( rc!=TH_ERROR ); | |
| 1549 | 1552 | } |
| 1550 | 1553 | |
| 1551 | 1554 | /* |
| 1552 | 1555 | ** Make an entry in the event table for a ticket change artifact. |
| 1553 | 1556 | */ |
| 1554 | 1557 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1497,21 +1497,24 @@ | |
| 1497 | ** Finish up a sequence of manifest_crosslink calls. |
| 1498 | */ |
| 1499 | int manifest_crosslink_end(int flags){ |
| 1500 | Stmt q, u; |
| 1501 | int i; |
| 1502 | int rc = TH_ERROR; |
| 1503 | assert( manifest_crosslink_busy==1 ); |
| 1504 | if( flags&MC_PERMIT_HOOKS ){ |
| 1505 | rc = xfer_run_common_script(); |
| 1506 | } |
| 1507 | db_prepare(&q, "SELECT uuid FROM pending_tkt"); |
| 1508 | while( db_step(&q)==SQLITE_ROW ){ |
| 1509 | const char *zUuid = db_column_text(&q, 0); |
| 1510 | ticket_rebuild_entry(zUuid); |
| 1511 | if( rc==TH_OK ){ |
| 1512 | rc = xfer_run_script(xfer_ticket_code(), zUuid); |
| 1513 | } |
| 1514 | } |
| 1515 | db_finalize(&q); |
| 1516 | db_multi_exec("DROP TABLE pending_tkt"); |
| 1517 | |
| @@ -1543,11 +1546,11 @@ | |
| 1543 | "DROP TABLE time_fudge;" |
| 1544 | ); |
| 1545 | |
| 1546 | db_end_transaction(0); |
| 1547 | manifest_crosslink_busy = 0; |
| 1548 | return rc; |
| 1549 | } |
| 1550 | |
| 1551 | /* |
| 1552 | ** Make an entry in the event table for a ticket change artifact. |
| 1553 | */ |
| 1554 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1497,21 +1497,24 @@ | |
| 1497 | ** Finish up a sequence of manifest_crosslink calls. |
| 1498 | */ |
| 1499 | int manifest_crosslink_end(int flags){ |
| 1500 | Stmt q, u; |
| 1501 | int i; |
| 1502 | int rc = TH_OK; |
| 1503 | int permitHooks = (flags & MC_PERMIT_HOOKS); |
| 1504 | const char *zScript = 0; |
| 1505 | assert( manifest_crosslink_busy==1 ); |
| 1506 | zScript = xfer_ticket_code(); |
| 1507 | if( zScript && permitHooks ){ |
| 1508 | rc = xfer_run_common_script(); |
| 1509 | } |
| 1510 | db_prepare(&q, "SELECT uuid FROM pending_tkt"); |
| 1511 | while( db_step(&q)==SQLITE_ROW ){ |
| 1512 | const char *zUuid = db_column_text(&q, 0); |
| 1513 | ticket_rebuild_entry(zUuid); |
| 1514 | if( rc==TH_OK && zScript && permitHooks ){ |
| 1515 | rc = xfer_run_script(zScript, zUuid); |
| 1516 | } |
| 1517 | } |
| 1518 | db_finalize(&q); |
| 1519 | db_multi_exec("DROP TABLE pending_tkt"); |
| 1520 | |
| @@ -1543,11 +1546,11 @@ | |
| 1546 | "DROP TABLE time_fudge;" |
| 1547 | ); |
| 1548 | |
| 1549 | db_end_transaction(0); |
| 1550 | manifest_crosslink_busy = 0; |
| 1551 | return ( rc!=TH_ERROR ); |
| 1552 | } |
| 1553 | |
| 1554 | /* |
| 1555 | ** Make an entry in the event table for a ticket change artifact. |
| 1556 | */ |
| 1557 |