Fossil SCM
Allow commits against a closed leaf as long as the new commit is on a different branch.
Commit
619fa857c9330c10ade2a1e23ee7faa193f347cb
Parent
76370b4c97eb010…
2 files changed
+13
-3
+13
-3
+13
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1677,15 +1677,25 @@ | ||
| 1677 | 1677 | ){ |
| 1678 | 1678 | fossil_fatal("would fork. \"update\" first or use --allow-fork."); |
| 1679 | 1679 | } |
| 1680 | 1680 | |
| 1681 | 1681 | /* |
| 1682 | - ** Do not allow a commit against a closed leaf on the same branch. | |
| 1682 | + ** Do not allow a commit against a closed leaf unless the commit | |
| 1683 | + ** ends up on a different branch. | |
| 1683 | 1684 | */ |
| 1684 | - if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref" | |
| 1685 | + if( | |
| 1686 | + /* parent checkin has the "closed" tag... */ | |
| 1687 | + db_exists("SELECT 1 FROM tagxref" | |
| 1685 | 1688 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1686 | - TAG_CLOSED, vid) ){ | |
| 1689 | + TAG_CLOSED, vid) | |
| 1690 | + /* ... and the new checkin has no --branch option or the --branch | |
| 1691 | + ** option does not actually change the branch */ | |
| 1692 | + && (sCiInfo.zBranch==0 | |
| 1693 | + || db_exists("SELECT 1 FROM tagxref" | |
| 1694 | + " WHERE tagid=%d AND rid=%d AND tagtype>0" | |
| 1695 | + " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch)) | |
| 1696 | + ){ | |
| 1687 | 1697 | fossil_fatal("cannot commit against a closed leaf"); |
| 1688 | 1698 | } |
| 1689 | 1699 | |
| 1690 | 1700 | if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1); |
| 1691 | 1701 | if( zComment ){ |
| 1692 | 1702 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1677,15 +1677,25 @@ | |
| 1677 | ){ |
| 1678 | fossil_fatal("would fork. \"update\" first or use --allow-fork."); |
| 1679 | } |
| 1680 | |
| 1681 | /* |
| 1682 | ** Do not allow a commit against a closed leaf on the same branch. |
| 1683 | */ |
| 1684 | if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref" |
| 1685 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1686 | TAG_CLOSED, vid) ){ |
| 1687 | fossil_fatal("cannot commit against a closed leaf"); |
| 1688 | } |
| 1689 | |
| 1690 | if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1); |
| 1691 | if( zComment ){ |
| 1692 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1677,15 +1677,25 @@ | |
| 1677 | ){ |
| 1678 | fossil_fatal("would fork. \"update\" first or use --allow-fork."); |
| 1679 | } |
| 1680 | |
| 1681 | /* |
| 1682 | ** Do not allow a commit against a closed leaf unless the commit |
| 1683 | ** ends up on a different branch. |
| 1684 | */ |
| 1685 | if( |
| 1686 | /* parent checkin has the "closed" tag... */ |
| 1687 | db_exists("SELECT 1 FROM tagxref" |
| 1688 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1689 | TAG_CLOSED, vid) |
| 1690 | /* ... and the new checkin has no --branch option or the --branch |
| 1691 | ** option does not actually change the branch */ |
| 1692 | && (sCiInfo.zBranch==0 |
| 1693 | || db_exists("SELECT 1 FROM tagxref" |
| 1694 | " WHERE tagid=%d AND rid=%d AND tagtype>0" |
| 1695 | " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch)) |
| 1696 | ){ |
| 1697 | fossil_fatal("cannot commit against a closed leaf"); |
| 1698 | } |
| 1699 | |
| 1700 | if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1); |
| 1701 | if( zComment ){ |
| 1702 |
+13
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1677,15 +1677,25 @@ | ||
| 1677 | 1677 | ){ |
| 1678 | 1678 | fossil_fatal("would fork. \"update\" first or use --allow-fork."); |
| 1679 | 1679 | } |
| 1680 | 1680 | |
| 1681 | 1681 | /* |
| 1682 | - ** Do not allow a commit against a closed leaf on the same branch. | |
| 1682 | + ** Do not allow a commit against a closed leaf unless the commit | |
| 1683 | + ** ends up on a different branch. | |
| 1683 | 1684 | */ |
| 1684 | - if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref" | |
| 1685 | + if( | |
| 1686 | + /* parent checkin has the "closed" tag... */ | |
| 1687 | + db_exists("SELECT 1 FROM tagxref" | |
| 1685 | 1688 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1686 | - TAG_CLOSED, vid) ){ | |
| 1689 | + TAG_CLOSED, vid) | |
| 1690 | + /* ... and the new checkin has no --branch option or the --branch | |
| 1691 | + ** option does not actually change the branch */ | |
| 1692 | + && (sCiInfo.zBranch==0 | |
| 1693 | + || db_exists("SELECT 1 FROM tagxref" | |
| 1694 | + " WHERE tagid=%d AND rid=%d AND tagtype>0" | |
| 1695 | + " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch)) | |
| 1696 | + ){ | |
| 1687 | 1697 | fossil_fatal("cannot commit against a closed leaf"); |
| 1688 | 1698 | } |
| 1689 | 1699 | |
| 1690 | 1700 | if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1); |
| 1691 | 1701 | if( zComment ){ |
| 1692 | 1702 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1677,15 +1677,25 @@ | |
| 1677 | ){ |
| 1678 | fossil_fatal("would fork. \"update\" first or use --allow-fork."); |
| 1679 | } |
| 1680 | |
| 1681 | /* |
| 1682 | ** Do not allow a commit against a closed leaf on the same branch. |
| 1683 | */ |
| 1684 | if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref" |
| 1685 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1686 | TAG_CLOSED, vid) ){ |
| 1687 | fossil_fatal("cannot commit against a closed leaf"); |
| 1688 | } |
| 1689 | |
| 1690 | if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1); |
| 1691 | if( zComment ){ |
| 1692 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1677,15 +1677,25 @@ | |
| 1677 | ){ |
| 1678 | fossil_fatal("would fork. \"update\" first or use --allow-fork."); |
| 1679 | } |
| 1680 | |
| 1681 | /* |
| 1682 | ** Do not allow a commit against a closed leaf unless the commit |
| 1683 | ** ends up on a different branch. |
| 1684 | */ |
| 1685 | if( |
| 1686 | /* parent checkin has the "closed" tag... */ |
| 1687 | db_exists("SELECT 1 FROM tagxref" |
| 1688 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1689 | TAG_CLOSED, vid) |
| 1690 | /* ... and the new checkin has no --branch option or the --branch |
| 1691 | ** option does not actually change the branch */ |
| 1692 | && (sCiInfo.zBranch==0 |
| 1693 | || db_exists("SELECT 1 FROM tagxref" |
| 1694 | " WHERE tagid=%d AND rid=%d AND tagtype>0" |
| 1695 | " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch)) |
| 1696 | ){ |
| 1697 | fossil_fatal("cannot commit against a closed leaf"); |
| 1698 | } |
| 1699 | |
| 1700 | if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1); |
| 1701 | if( zComment ){ |
| 1702 |