Fossil SCM
Fix the is_a_leaf() function so that it correctly identifies nodes as leaves if they have no non-merge children in the same branch.
Commit
0a89d03cf658ecb54d63f22e872b569d6edba51c
Parent
085b6a1bbba91bb…
1 file changed
+2
-1
+2
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -468,11 +468,11 @@ | ||
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | /* |
| 472 | 472 | ** Return true if the check-in with RID=rid is a leaf. |
| 473 | -** A leaf has no children in the same branch. | |
| 473 | +** A leaf has no primary children in the same branch. | |
| 474 | 474 | */ |
| 475 | 475 | int is_a_leaf(int rid){ |
| 476 | 476 | int rc; |
| 477 | 477 | static const char zSql[] = |
| 478 | 478 | @ SELECT 1 FROM plink |
| @@ -479,10 +479,11 @@ | ||
| 479 | 479 | @ WHERE pid=%d |
| 480 | 480 | @ AND coalesce((SELECT value FROM tagxref |
| 481 | 481 | @ WHERE tagid=%d AND rid=plink.pid), 'trunk') |
| 482 | 482 | @ =coalesce((SELECT value FROM tagxref |
| 483 | 483 | @ WHERE tagid=%d AND rid=plink.cid), 'trunk') |
| 484 | + @ AND isprim | |
| 484 | 485 | ; |
| 485 | 486 | rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH); |
| 486 | 487 | return rc==0; |
| 487 | 488 | } |
| 488 | 489 | |
| 489 | 490 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -468,11 +468,11 @@ | |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | /* |
| 472 | ** Return true if the check-in with RID=rid is a leaf. |
| 473 | ** A leaf has no children in the same branch. |
| 474 | */ |
| 475 | int is_a_leaf(int rid){ |
| 476 | int rc; |
| 477 | static const char zSql[] = |
| 478 | @ SELECT 1 FROM plink |
| @@ -479,10 +479,11 @@ | |
| 479 | @ WHERE pid=%d |
| 480 | @ AND coalesce((SELECT value FROM tagxref |
| 481 | @ WHERE tagid=%d AND rid=plink.pid), 'trunk') |
| 482 | @ =coalesce((SELECT value FROM tagxref |
| 483 | @ WHERE tagid=%d AND rid=plink.cid), 'trunk') |
| 484 | ; |
| 485 | rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH); |
| 486 | return rc==0; |
| 487 | } |
| 488 | |
| 489 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -468,11 +468,11 @@ | |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | /* |
| 472 | ** Return true if the check-in with RID=rid is a leaf. |
| 473 | ** A leaf has no primary children in the same branch. |
| 474 | */ |
| 475 | int is_a_leaf(int rid){ |
| 476 | int rc; |
| 477 | static const char zSql[] = |
| 478 | @ SELECT 1 FROM plink |
| @@ -479,10 +479,11 @@ | |
| 479 | @ WHERE pid=%d |
| 480 | @ AND coalesce((SELECT value FROM tagxref |
| 481 | @ WHERE tagid=%d AND rid=plink.pid), 'trunk') |
| 482 | @ =coalesce((SELECT value FROM tagxref |
| 483 | @ WHERE tagid=%d AND rid=plink.cid), 'trunk') |
| 484 | @ AND isprim |
| 485 | ; |
| 486 | rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH); |
| 487 | return rc==0; |
| 488 | } |
| 489 | |
| 490 |