Overview
SHA1 Hash: | 844718abbfb4b49f05986501161a90d4a530d1a7 |
---|---|
Date: | 2008-05-13 13:20:27 |
User: | drh |
Comment: | 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. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/add.c from [5acaff69fc] to [e817fb01ea].
@@ -62,22 +62,26 @@ if( isDir==2 && access(zName, R_OK) ){ fossil_fatal("cannot open %s", zName); } file_tree_name(zName, &pathname); zPath = blob_str(&pathname); - if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){ - fossil_fatal("cannot add %s", zPath); - } - if( !file_is_simple_pathname(zPath) ){ - fossil_fatal("filename contains illegal characters: %s", zPath); - } - if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){ - db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath); + if( strcmp(zPath, "manifest")==0 + || strcmp(zPath, "_FOSSIL_")==0 + || strcmp(zPath, "manifest.uuid")==0 + ){ + fossil_warning("cannot add %s", zPath); }else{ - db_multi_exec( - "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)" - "VALUES(%d,0,0,0,%Q)", vid, zPath); + if( !file_is_simple_pathname(zPath) ){ + fossil_fatal("filename contains illegal characters: %s", zPath); + } + if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){ + db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath); + }else{ + db_multi_exec( + "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)" + "VALUES(%d,0,0,0,%Q)", vid, zPath); + } } blob_reset(&pathname); free(zName); } db_end_transaction(0);
Modified src/main.c from [d82321902f] to [b6f2004a21].
@@ -250,10 +250,22 @@ }else{ fprintf(stderr, "%s: %s\n", g.argv[0], z); } db_force_rollback(); exit(1); +} +void fossil_warning(const char *zFormat, ...){ + char *z; + va_list ap; + va_start(ap, zFormat); + z = vmprintf(zFormat, ap); + va_end(ap); + if( g.cgiPanic ){ + cgi_printf("<p><font color=\"red\">%h</font></p>", z); + }else{ + fprintf(stderr, "%s: %s\n", g.argv[0], z); + } } /* ** Print a usage comment and quit */