Fossil SCM

Allow a checkin to be checked out again even if one of the files in that checkin has been shunned.

drh 2010-08-11 07:00 trunk
Commit 7e23178ba332b0d6089dd7ef3a363fdd6739d4b3
1 file changed +9 -4
+9 -4
--- src/vfile.c
+++ src/vfile.c
@@ -60,12 +60,17 @@
6060
6161
/*
6262
** Verify that an object is not a phantom. If the object is
6363
** a phantom, output an error message and quick.
6464
*/
65
-void vfile_verify_not_phantom(int rid, const char *zFilename){
66
- if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
65
+static void vfile_verify_not_phantom(
66
+ int rid, /* The RID to verify */
67
+ const char *zFilename, /* Filename. Might be NULL */
68
+ const char *zUuid /* UUID. Might be NULL */
69
+){
70
+ if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0
71
+ && (zUuid==0 || !db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid)) ){
6772
if( zFilename ){
6873
fossil_fatal("content missing for %s", zFilename);
6974
}else{
7075
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
7176
if( zUuid ){
@@ -90,11 +95,11 @@
9095
char *zName, *zUuid;
9196
Stmt ins;
9297
Blob line, token, name, uuid;
9398
int seenHeader = 0;
9499
db_begin_transaction();
95
- vfile_verify_not_phantom(vid, 0);
100
+ vfile_verify_not_phantom(vid, 0, 0);
96101
db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
97102
db_prepare(&ins,
98103
"INSERT INTO vfile(vid,rid,mrid,pathname) "
99104
" VALUES(:vid,:id,:id,:name)");
100105
db_bind_int(&ins, ":vid", vid);
@@ -112,11 +117,11 @@
112117
if( blob_token(&line, &uuid)==0 ) break;
113118
zName = blob_str(&name);
114119
defossilize(zName);
115120
zUuid = blob_str(&uuid);
116121
rid = uuid_to_rid(zUuid, 0);
117
- vfile_verify_not_phantom(rid, zName);
122
+ vfile_verify_not_phantom(rid, zName, zUuid);
118123
if( rid>0 && file_is_simple_pathname(zName) ){
119124
db_bind_int(&ins, ":id", rid);
120125
db_bind_text(&ins, ":name", zName);
121126
db_step(&ins);
122127
db_reset(&ins);
123128
--- src/vfile.c
+++ src/vfile.c
@@ -60,12 +60,17 @@
60
61 /*
62 ** Verify that an object is not a phantom. If the object is
63 ** a phantom, output an error message and quick.
64 */
65 void vfile_verify_not_phantom(int rid, const char *zFilename){
66 if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
 
 
 
 
 
67 if( zFilename ){
68 fossil_fatal("content missing for %s", zFilename);
69 }else{
70 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
71 if( zUuid ){
@@ -90,11 +95,11 @@
90 char *zName, *zUuid;
91 Stmt ins;
92 Blob line, token, name, uuid;
93 int seenHeader = 0;
94 db_begin_transaction();
95 vfile_verify_not_phantom(vid, 0);
96 db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
97 db_prepare(&ins,
98 "INSERT INTO vfile(vid,rid,mrid,pathname) "
99 " VALUES(:vid,:id,:id,:name)");
100 db_bind_int(&ins, ":vid", vid);
@@ -112,11 +117,11 @@
112 if( blob_token(&line, &uuid)==0 ) break;
113 zName = blob_str(&name);
114 defossilize(zName);
115 zUuid = blob_str(&uuid);
116 rid = uuid_to_rid(zUuid, 0);
117 vfile_verify_not_phantom(rid, zName);
118 if( rid>0 && file_is_simple_pathname(zName) ){
119 db_bind_int(&ins, ":id", rid);
120 db_bind_text(&ins, ":name", zName);
121 db_step(&ins);
122 db_reset(&ins);
123
--- src/vfile.c
+++ src/vfile.c
@@ -60,12 +60,17 @@
60
61 /*
62 ** Verify that an object is not a phantom. If the object is
63 ** a phantom, output an error message and quick.
64 */
65 static void vfile_verify_not_phantom(
66 int rid, /* The RID to verify */
67 const char *zFilename, /* Filename. Might be NULL */
68 const char *zUuid /* UUID. Might be NULL */
69 ){
70 if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0
71 && (zUuid==0 || !db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid)) ){
72 if( zFilename ){
73 fossil_fatal("content missing for %s", zFilename);
74 }else{
75 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
76 if( zUuid ){
@@ -90,11 +95,11 @@
95 char *zName, *zUuid;
96 Stmt ins;
97 Blob line, token, name, uuid;
98 int seenHeader = 0;
99 db_begin_transaction();
100 vfile_verify_not_phantom(vid, 0, 0);
101 db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
102 db_prepare(&ins,
103 "INSERT INTO vfile(vid,rid,mrid,pathname) "
104 " VALUES(:vid,:id,:id,:name)");
105 db_bind_int(&ins, ":vid", vid);
@@ -112,11 +117,11 @@
117 if( blob_token(&line, &uuid)==0 ) break;
118 zName = blob_str(&name);
119 defossilize(zName);
120 zUuid = blob_str(&uuid);
121 rid = uuid_to_rid(zUuid, 0);
122 vfile_verify_not_phantom(rid, zName, zUuid);
123 if( rid>0 && file_is_simple_pathname(zName) ){
124 db_bind_int(&ins, ":id", rid);
125 db_bind_text(&ins, ":name", zName);
126 db_step(&ins);
127 db_reset(&ins);
128

Keyboard Shortcuts

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