Fossil SCM

Improved the checkout/repo mismatch check based on off-list discussion.

stephan 2013-10-04 15:18 trunk
Commit 7557c3e03f74be4dbe7078725cd506802f6446f8
1 file changed +15 -2
+15 -2
--- src/checkin.c
+++ src/checkin.c
@@ -987,12 +987,25 @@
987987
const char *zColor; /* Modified value of p->zColor */
988988
989989
assert( pBaseline==0 || pBaseline->zBaseline==0 );
990990
assert( pBaseline==0 || zBaselineUuid!=0 );
991991
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 ){
9941007
blob_appendf(pOut, "B %s\n", zBaselineUuid);
9951008
manifest_file_rewind(pBaseline);
9961009
pFile = manifest_file_next(pBaseline, 0);
9971010
nFBcard++;
9981011
}else{
9991012
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button