Diff
Not logged in

Differences From:

File src/manifest.c part of check-in [f0c8693845] - More improvements to the timeline display of ticket changes. by drh on 2008-10-20 06:41:12. [view]

To:

File src/manifest.c part of check-in [2bde9f9b3d] - Add "ci" as an alias for "commit". Make provisions for a future "fossil mv" command. by drh on 2008-10-21 06:10:33. [view]

@@ -142,9 +142,9 @@
 int manifest_parse(Manifest *p, Blob *pContent){
   int seenHeader = 0;
   int seenZ = 0;
   int i, lineNo=0;
-  Blob line, token, a1, a2, a3;
+  Blob line, token, a1, a2, a3, a4;
   char cPrevType = 0;
 
   memset(p, 0, sizeof(*p));
   memcpy(&p->content, pContent, sizeof(p->content));
@@ -273,16 +273,16 @@
         break;
       }
 
       /*
-      **     F <filename> <uuid> ?<permissions>?
+      **     F <filename> <uuid> ?<permissions>? ?<old-name>?
       **
       ** Identifies a file in a manifest.  Multiple F lines are
       ** allowed in a manifest.  F lines are not allowed in any
-      ** other control file.  The filename is fossil-encoded.
+      ** other control file.  The filename and old-name are fossil-encoded.
       */
       case 'F': {
-        char *zName, *zUuid, *zPerm;
+        char *zName, *zUuid, *zPerm, *zPriorName;
         md5sum_step_text(blob_buffer(&line), blob_size(&line));
         if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error;
         if( blob_token(&line, &a2)==0 ) goto manifest_syntax_error;
         zName = blob_terminate(&a1);
@@ -293,8 +293,16 @@
         if( !validate16(zUuid, UUID_SIZE) ) goto manifest_syntax_error;
         defossilize(zName);
         if( !file_is_simple_pathname(zName) ){
           goto manifest_syntax_error;
+        }
+        blob_token(&line, &a4);
+        zPriorName = blob_terminate(&a4);
+        if( zPriorName[0] ){
+          defossilize(zPriorName);
+          if( !file_is_simple_pathname(zPriorName) ){
+            goto manifest_syntax_error;
+          }
         }
         if( p->nFile>=p->nFileAlloc ){
           p->nFileAlloc = p->nFileAlloc*2 + 10;
           p->aFile = realloc(p->aFile, p->nFileAlloc*sizeof(p->aFile[0]) );