Fossil SCM

Make attempts to add _FOSSIL_, manifest, and manifest.uuid warnings, not fatal errors. This allows users to say things like "fossil add *" when initially populating a new project repository.

drh 2008-05-13 13:20 trunk
Commit 844718abbfb4b49f05986501161a90d4a530d1a7
2 files changed +15 -11 +12
+15 -11
--- src/add.c
+++ src/add.c
@@ -62,22 +62,26 @@
6262
if( isDir==2 && access(zName, R_OK) ){
6363
fossil_fatal("cannot open %s", zName);
6464
}
6565
file_tree_name(zName, &pathname);
6666
zPath = blob_str(&pathname);
67
- if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
68
- fossil_fatal("cannot add %s", zPath);
69
- }
70
- if( !file_is_simple_pathname(zPath) ){
71
- fossil_fatal("filename contains illegal characters: %s", zPath);
72
- }
73
- if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
74
- db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
67
+ if( strcmp(zPath, "manifest")==0
68
+ || strcmp(zPath, "_FOSSIL_")==0
69
+ || strcmp(zPath, "manifest.uuid")==0
70
+ ){
71
+ fossil_warning("cannot add %s", zPath);
7572
}else{
76
- db_multi_exec(
77
- "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
78
- "VALUES(%d,0,0,0,%Q)", vid, zPath);
73
+ if( !file_is_simple_pathname(zPath) ){
74
+ fossil_fatal("filename contains illegal characters: %s", zPath);
75
+ }
76
+ if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
77
+ db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
78
+ }else{
79
+ db_multi_exec(
80
+ "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
81
+ "VALUES(%d,0,0,0,%Q)", vid, zPath);
82
+ }
7983
}
8084
blob_reset(&pathname);
8185
free(zName);
8286
}
8387
db_end_transaction(0);
8488
--- src/add.c
+++ src/add.c
@@ -62,22 +62,26 @@
62 if( isDir==2 && access(zName, R_OK) ){
63 fossil_fatal("cannot open %s", zName);
64 }
65 file_tree_name(zName, &pathname);
66 zPath = blob_str(&pathname);
67 if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
68 fossil_fatal("cannot add %s", zPath);
69 }
70 if( !file_is_simple_pathname(zPath) ){
71 fossil_fatal("filename contains illegal characters: %s", zPath);
72 }
73 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
74 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
75 }else{
76 db_multi_exec(
77 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
78 "VALUES(%d,0,0,0,%Q)", vid, zPath);
 
 
 
 
 
 
 
79 }
80 blob_reset(&pathname);
81 free(zName);
82 }
83 db_end_transaction(0);
84
--- src/add.c
+++ src/add.c
@@ -62,22 +62,26 @@
62 if( isDir==2 && access(zName, R_OK) ){
63 fossil_fatal("cannot open %s", zName);
64 }
65 file_tree_name(zName, &pathname);
66 zPath = blob_str(&pathname);
67 if( strcmp(zPath, "manifest")==0
68 || strcmp(zPath, "_FOSSIL_")==0
69 || strcmp(zPath, "manifest.uuid")==0
70 ){
71 fossil_warning("cannot add %s", zPath);
 
 
 
72 }else{
73 if( !file_is_simple_pathname(zPath) ){
74 fossil_fatal("filename contains illegal characters: %s", zPath);
75 }
76 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
77 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
78 }else{
79 db_multi_exec(
80 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
81 "VALUES(%d,0,0,0,%Q)", vid, zPath);
82 }
83 }
84 blob_reset(&pathname);
85 free(zName);
86 }
87 db_end_transaction(0);
88
+12
--- src/main.c
+++ src/main.c
@@ -250,10 +250,22 @@
250250
}else{
251251
fprintf(stderr, "%s: %s\n", g.argv[0], z);
252252
}
253253
db_force_rollback();
254254
exit(1);
255
+}
256
+void fossil_warning(const char *zFormat, ...){
257
+ char *z;
258
+ va_list ap;
259
+ va_start(ap, zFormat);
260
+ z = vmprintf(zFormat, ap);
261
+ va_end(ap);
262
+ if( g.cgiPanic ){
263
+ cgi_printf("<p><font color=\"red\">%h</font></p>", z);
264
+ }else{
265
+ fprintf(stderr, "%s: %s\n", g.argv[0], z);
266
+ }
255267
}
256268
257269
/*
258270
** Print a usage comment and quit
259271
*/
260272
--- src/main.c
+++ src/main.c
@@ -250,10 +250,22 @@
250 }else{
251 fprintf(stderr, "%s: %s\n", g.argv[0], z);
252 }
253 db_force_rollback();
254 exit(1);
 
 
 
 
 
 
 
 
 
 
 
 
255 }
256
257 /*
258 ** Print a usage comment and quit
259 */
260
--- src/main.c
+++ src/main.c
@@ -250,10 +250,22 @@
250 }else{
251 fprintf(stderr, "%s: %s\n", g.argv[0], z);
252 }
253 db_force_rollback();
254 exit(1);
255 }
256 void fossil_warning(const char *zFormat, ...){
257 char *z;
258 va_list ap;
259 va_start(ap, zFormat);
260 z = vmprintf(zFormat, ap);
261 va_end(ap);
262 if( g.cgiPanic ){
263 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
264 }else{
265 fprintf(stderr, "%s: %s\n", g.argv[0], z);
266 }
267 }
268
269 /*
270 ** Print a usage comment and quit
271 */
272

Keyboard Shortcuts

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