Diff
Not logged in

Differences From:

File src/add.c part of check-in [dbda8d6ce9] - Initial check-in of m1 sources. by drh on 2007-07-21 14:10:57. [view]

To:

File src/add.c part of check-in [20bcbcf2f2] - Make sure a user does not attempt to "fossil add" the manifest or the _FOSSIL_ files. by drh on 2007-08-08 15:22:43. [view]

@@ -54,15 +54,18 @@
     zName = mprintf("%s", g.argv[i]);
     isDir = file_isdir(zName);
     if( isDir==1 ) continue;
     if( isDir==0 ){
-      fossil_panic("not found: %s\n", zName);
+      fossil_fatal("not found: %s", zName);
     }
     if( isDir==2 && access(zName, R_OK) ){
-      fossil_panic("cannot open %s\n", zName);
+      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( 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(
@@ -100,9 +103,9 @@
     file_tree_name(zName, &pathname);
     zPath = blob_str(&pathname);
     if( !db_exists(
              "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){
-      fossil_panic("not in the repository: %s\n", zName);
+      fossil_fatal("not in the repository: %s", zName);
     }else{
       db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zPath);
     }
     blob_reset(&pathname);