diff

Index: src/file.c
==================================================================
--- src/file.c
+++ src/file.c
@@ -118,40 +118,45 @@
   }else{
     if( fossil_stat(zFilename, &fileStat, isWd)!=0 ){
       fileStatValid = 0;
       rc = 1;
     }else{
       fileStatValid = 1;
       rc = 0;
     }
   }
   return rc;
 }
 
 /*
 ** Return the size of a file in bytes.  Return -1 if the file does not
 ** exist.  If zFilename is NULL, return the size of the most recently
 ** stat-ed file.
 */
 i64 file_size(const char *zFilename){
   return getStat(zFilename, 0) ? -1 : fileStat.st_size;
 }
+
+void file_touch(const char *zFilename){
+    FILE *fh = fopen(zFilename,"w");
+    fclose(fh);
+}
 
 /*
 ** Same as file_size(), but takes into account symlinks.
 */
 i64 file_wd_size(const char *zFilename){
   return getStat(zFilename, 1) ? -1 : fileStat.st_size;
 }
 
 /*
 ** Return the modification time for a file.  Return -1 if the file
 ** does not exist.  If zFilename is NULL return the size of the most
 ** recently stat-ed file.
 */
 i64 file_mtime(const char *zFilename){
   return getStat(zFilename, 0) ? -1 : fileStat.st_mtime;
 }
 
 /*
 ** Same as file_mtime(), but takes into account symlinks.
 */

Index: src/merge3.c
==================================================================
--- src/merge3.c
+++ src/merge3.c
@@ -16,40 +16,42 @@
 *******************************************************************************
 **
 ** This module implements a 3-way merge
 */
 #include "config.h"
 #include "merge3.h"
 
 #if 0
 #define DEBUG(X)  X
 #define ISDEBUG 1
 #else
 #define DEBUG(X)
 #define ISDEBUG 0
 #endif
 
 /* The minimum of two integers */
 #ifndef min
 #  define min(A,B)  (A0 ){
       const char *zGMerge;   /* Name of the gmerge command */
 
       zGMerge = db_get("gmerge-command", 0);
       if( zGMerge && zGMerge[0] ){
         char *zOut;     /* Temporary output file */
         char *zCmd;     /* Command to invoke */
         const char *azSubst[8];  /* Strings to be substituted */
-
+        int status;
+        
         zOut = file_newname(zV1, "output", 1);
         azSubst[0] = "%baseline";  azSubst[1] = zPivot;
         azSubst[2] = "%original";  azSubst[3] = zOrig;
         azSubst[4] = "%merge";     azSubst[5] = zOther;
         azSubst[6] = "%output";    azSubst[7] = zOut;
         zCmd = string_subst(zGMerge, 8, azSubst);
         printf("%s\n", zCmd); fflush(stdout);
+        file_touch(zOut);
         fossil_system(zCmd);
-        if( file_wd_size(zOut)>=0 ){
+        if( file_wd_size(zOut)>0 ){
           blob_read_from_file(pOut, zOut);
           file_delete(zPivot);
           file_delete(zOrig);
           file_delete(zOther);
           file_delete(zOut);
         }
         fossil_free(zCmd);
         fossil_free(zOut);
       }
     }
     fossil_free(zPivot);
     fossil_free(zOrig);
     fossil_free(zOther);
   }
   blob_reset(&v1);
   return rc;
 }

_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to