Fossil SCM
Improved the checkout/repo mismatch check based on off-list discussion.
Commit
7557c3e03f74be4dbe7078725cd506802f6446f8
Parent
c72c19b8f1b6715…
1 file changed
+15
-2
+15
-2
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -987,12 +987,25 @@ | ||
| 987 | 987 | const char *zColor; /* Modified value of p->zColor */ |
| 988 | 988 | |
| 989 | 989 | assert( pBaseline==0 || pBaseline->zBaseline==0 ); |
| 990 | 990 | assert( pBaseline==0 || zBaselineUuid!=0 ); |
| 991 | 991 | blob_zero(pOut); |
| 992 | - zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); | |
| 993 | - if( pBaseline ){ | |
| 992 | + zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d " | |
| 993 | + "AND EXISTS (SELECT 1 FROM mlink WHERE mid=%d)", | |
| 994 | + vid, vid) | |
| 995 | + /* | |
| 996 | + ** The subselect there ensures that the given vid refers to a | |
| 997 | + ** MANIFEST in this repo. It catches an error which would else | |
| 998 | + ** show up downstream (during verify-at-commit, if we're lucky) | |
| 999 | + ** if the checkout version RID somehow gets out of sync with the | |
| 1000 | + ** current copy of the repo. | |
| 1001 | + */; | |
| 1002 | + if(vid>0 && !zParentUuid){ | |
| 1003 | + fossil_fatal("Could not find manifest for RID %d. " | |
| 1004 | + "Possible checkout/repo mismatch.", vid); | |
| 1005 | + } | |
| 1006 | + else if( pBaseline ){ | |
| 994 | 1007 | blob_appendf(pOut, "B %s\n", zBaselineUuid); |
| 995 | 1008 | manifest_file_rewind(pBaseline); |
| 996 | 1009 | pFile = manifest_file_next(pBaseline, 0); |
| 997 | 1010 | nFBcard++; |
| 998 | 1011 | }else{ |
| 999 | 1012 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -987,12 +987,25 @@ | |
| 987 | const char *zColor; /* Modified value of p->zColor */ |
| 988 | |
| 989 | assert( pBaseline==0 || pBaseline->zBaseline==0 ); |
| 990 | assert( pBaseline==0 || zBaselineUuid!=0 ); |
| 991 | blob_zero(pOut); |
| 992 | zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| 993 | if( pBaseline ){ |
| 994 | blob_appendf(pOut, "B %s\n", zBaselineUuid); |
| 995 | manifest_file_rewind(pBaseline); |
| 996 | pFile = manifest_file_next(pBaseline, 0); |
| 997 | nFBcard++; |
| 998 | }else{ |
| 999 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -987,12 +987,25 @@ | |
| 987 | const char *zColor; /* Modified value of p->zColor */ |
| 988 | |
| 989 | assert( pBaseline==0 || pBaseline->zBaseline==0 ); |
| 990 | assert( pBaseline==0 || zBaselineUuid!=0 ); |
| 991 | blob_zero(pOut); |
| 992 | zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d " |
| 993 | "AND EXISTS (SELECT 1 FROM mlink WHERE mid=%d)", |
| 994 | vid, vid) |
| 995 | /* |
| 996 | ** The subselect there ensures that the given vid refers to a |
| 997 | ** MANIFEST in this repo. It catches an error which would else |
| 998 | ** show up downstream (during verify-at-commit, if we're lucky) |
| 999 | ** if the checkout version RID somehow gets out of sync with the |
| 1000 | ** current copy of the repo. |
| 1001 | */; |
| 1002 | if(vid>0 && !zParentUuid){ |
| 1003 | fossil_fatal("Could not find manifest for RID %d. " |
| 1004 | "Possible checkout/repo mismatch.", vid); |
| 1005 | } |
| 1006 | else if( pBaseline ){ |
| 1007 | blob_appendf(pOut, "B %s\n", zBaselineUuid); |
| 1008 | manifest_file_rewind(pBaseline); |
| 1009 | pFile = manifest_file_next(pBaseline, 0); |
| 1010 | nFBcard++; |
| 1011 | }else{ |
| 1012 |