Diff
Not logged in

Differences From:

File src/vfile.c part of check-in [22552fb803] - Extend the commit command so that specific files can be committed. There are still some problems with doing this after a merge. by dan on 2007-08-03 15:31:33. [view]

To:

File src/vfile.c part of check-in [5c74c300b1] - Changes to the checksum verification steps to allow a partial commit of changes after new files are added to the tree. by drh on 2007-08-04 00:38:38. [view]

@@ -258,8 +258,10 @@
 ** This function operates differently if the Global.aCommitFile
 ** variable is not NULL. In that case, the disk image is used for
 ** each file in aCommitFile[] and the repository image (see
 ** vfile_aggregate_checksum_repository() is used for all others).
+** Newly added files that are not contained in the repository are
+** omitted from the checksum if they are not in Global.aCommitFile.
 **
 ** Return the resulting checksum in blob pOut.
 */
 void vfile_aggregate_checksum_disk(int vid, Blob *pOut){
@@ -279,11 +281,10 @@
     const char *zFullpath = db_column_text(&q, 0);
     const char *zName = db_column_text(&q, 1);
     int isSelected = db_column_int(&q, 2);
 
-    md5sum_step_text(zName, -1);
-
     if( isSelected ){
+      md5sum_step_text(zName, -1);
       in = fopen(zFullpath,"rb");
       if( in==0 ){
         md5sum_step_text(" 0\n", -1);
         continue;
@@ -303,14 +304,17 @@
       int rid = db_column_int(&q, 3);
       char zBuf[100];
       Blob file;
 
-      blob_zero(&file);
-      content_get(rid, &file);
-      sprintf(zBuf, " %d\n", blob_size(&file));
-      md5sum_step_text(zBuf, -1);
-      md5sum_step_blob(&file);
-      blob_reset(&file);
+      if( rid>0 ){
+        md5sum_step_text(zName, -1);
+        blob_zero(&file);
+        content_get(rid, &file);
+        sprintf(zBuf, " %d\n", blob_size(&file));
+        md5sum_step_text(zBuf, -1);
+        md5sum_step_blob(&file);
+        blob_reset(&file);
+      }
     }
   }
   db_finalize(&q);
   md5sum_finish(pOut);