Check-in [b3ec774ab7]
Not logged in
Overview

SHA1 Hash:b3ec774ab7edcaa610aa216fd94cd5029650555c
Date: 2008-02-08 16:24:24
User: drh
Comment:Fail with an error if a file is outside the checkout tree.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/checkin.c from [aebfba90e8] to [cd202e5357].

@@ -290,13 +290,11 @@
     blob_zero(&b);
     g.aCommitFile = malloc(sizeof(int)*(g.argc-1));
 
     for(ii=2; ii<g.argc; ii++){
       int iId;
-      if( !file_tree_name(g.argv[ii], &b) ){
-        fossil_fatal("file is not in tree: %s", g.argv[ii]);
-      }
+      file_tree_name(g.argv[ii], &b);
       iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b));
       if( iId<0 ){
         fossil_fatal("fossil knows nothing about: %s", g.argv[ii]);
       }
       g.aCommitFile[ii-2] = iId;

Modified src/diffcmd.c from [a54672e2c8] to [4f6e43e19f].

@@ -99,13 +99,11 @@
     }
     blob_zero(&cmd);
     blob_appendf(&cmd, "%s ", zExternalCommand);
   }
   zFile = g.argv[g.argc-1];
-  if( !file_tree_name(zFile, &fname) ){
-    fossil_panic("unknown file: %s", zFile);
-  }
+  file_tree_name(zFile, &fname);
 
   blob_zero(&vname);
   do{
     blob_reset(&vname);
     blob_appendf(&vname, "%s~%d", zFile, cnt++);

Modified src/file.c from [be58713833] to [d8c82766a0].

@@ -284,12 +284,12 @@
   }
 }
 
 /*
 ** Compute a pathname for a file relative to the root of the local
-** tree.  Return TRUE on success and FALSE if the file is not contained
-** in the local tree.
+** tree.  Return TRUE on success.  On failure, print and error
+** message and quit.
 **
 ** The root of the tree is defined by the g.zLocalRoot variable.
 */
 int file_tree_name(const char *zOrigName, Blob *pOut){
   int n;
@@ -297,10 +297,11 @@
   db_must_be_within_tree();
   file_canonical_name(zOrigName, &full);
   n = strlen(g.zLocalRoot);
   if( blob_size(&full)<=n || memcmp(g.zLocalRoot, blob_buffer(&full), n) ){
     blob_reset(&full);
+    fossil_fatal("file outside of checkout tree: %s", zOrigName);
     return 0;
   }
   blob_zero(pOut);
   blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n);
   return 1;

Modified src/update.c from [de06d69ffd] to [c2214489e0].

@@ -303,13 +303,11 @@
   }
   db_must_be_within_tree();
 
   zFile = mprintf("%/", g.argv[g.argc-1]);
 
-  if( !file_tree_name(zFile, &fname) ){
-    fossil_panic("unknown file: %s", zFile);
-  }
+  file_tree_name(zFile, &fname);
 
   if( access(zFile, 0) ) yesRevert = 1;
   if( yesRevert==0 ){
     char *prompt = mprintf("revert file %B? this will"
                            " destroy local changes [y/N]? ",

Modified src/wiki.c from [fb0624012e] to [bddf828de5].

@@ -596,6 +596,5 @@
   @ disables all wiki formatting rules through the matching
   @ &lt;/nowiki&gt; element.
   @ </ol>
   style_footer();
 }
-