Diff
Not logged in

Differences From:

File src/checkin.c part of check-in [0431f14edf] - Once a successful commit is made, if autosync is on, a push is now done. This commit will be the first test of that new functionality :-) by jnc on 2007-09-25 07:11:57. [view]

To:

File src/checkin.c part of check-in [fff234b77c] - Updates to the autosync logic. Add the "setting" command. by drh on 2007-09-25 20:23:52. [view]

@@ -324,8 +324,9 @@
   Stmt q2;
   char *zUuid, *zDate;
   int noSign = 0;        /* True to omit signing the manifest using GPG */
   int isAMerge = 0;      /* True if checking in a merge */
+  int forceFlag = 0;     /* Force a fork */
   char *zManifestFile;   /* Name of the manifest file */
   Blob manifest;
   Blob muuid;            /* Manifest uuid */
   Blob mcksum;           /* Self-checksum on the manifest */
@@ -333,11 +334,17 @@
   Blob cksum1b;          /* Checksum recorded in the manifest */
 
   noSign = find_option("nosign","",0)!=0;
   zComment = find_option("comment","m",1);
+  forceFlag = find_option("force", "r", 0)!=0;
   db_must_be_within_tree();
   noSign = db_get_int("omit-ci-sig", 0)|noSign;
   verify_all_options();
+
+  /*
+  ** Autosync if requested.
+  */
+  autosync(1);
 
   /* There are two ways this command may be executed. If there are
   ** no arguments following the word "commit", then all modified files
   ** in the checked out directory are committed. If one or more arguments
@@ -356,9 +363,9 @@
 
   user_select();
   db_begin_transaction();
   rc = unsaved_changes();
-  if( rc==0 && !isAMerge ){
+  if( rc==0 && !isAMerge && !forceFlag ){
     fossil_panic("nothing has changed");
   }
 
   /* If one or more files that were named on the command line have not
@@ -376,8 +383,11 @@
     }
   }
 
   vid = db_lget_int("checkout", 0);
+  if( !forceFlag && db_exists("SELECT 1 FROM plink WHERE pid=%d", vid) ){
+    fossil_fatal("would fork.  use -f or --force");
+  }
   vfile_aggregate_checksum_disk(vid, &cksum1);
   if( zComment ){
     blob_zero(&comment);
     blob_append(&comment, zComment, -1);
@@ -525,11 +535,7 @@
 
   /* Commit */
   db_end_transaction(0);
 
-  /* Autosync and do a push? */
-  if( do_autosync() ){
-    g.argc=2;
-    g.argv[1]="push";
-    push_cmd();
-  }
+  /* Do an autosync push if requested */
+  autosync(0);
 }