Fossil SCM
Print a warning and require confirmation prior to continuing with a commit after detection of time skew.
Commit
c6a65cbd8176ab1fba402708064bc70222a509ff
Parent
71c40d3bdb9186b…
3 files changed
+12
+1
+1
+12
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -644,10 +644,22 @@ | ||
| 644 | 644 | ** Autosync if autosync is enabled and this is not a private check-in. |
| 645 | 645 | */ |
| 646 | 646 | if( !g.markPrivate ){ |
| 647 | 647 | autosync(AUTOSYNC_PULL); |
| 648 | 648 | } |
| 649 | + | |
| 650 | + /* Require confirmation to continue with the check-in if there is | |
| 651 | + ** clock skew | |
| 652 | + */ | |
| 653 | + if( g.clockSkewSeen ){ | |
| 654 | + Blob ans; | |
| 655 | + blob_zero(&ans); | |
| 656 | + prompt_user("continue in spite of time skew (y/N)? ", &ans); | |
| 657 | + if( blob_str(&ans)[0]!='y' ){ | |
| 658 | + fossil_exit(1); | |
| 659 | + } | |
| 660 | + } | |
| 649 | 661 | |
| 650 | 662 | /* There are two ways this command may be executed. If there are |
| 651 | 663 | ** no arguments following the word "commit", then all modified files |
| 652 | 664 | ** in the checked out directory are committed. If one or more arguments |
| 653 | 665 | ** follows "commit", then only those files are committed. |
| 654 | 666 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -644,10 +644,22 @@ | |
| 644 | ** Autosync if autosync is enabled and this is not a private check-in. |
| 645 | */ |
| 646 | if( !g.markPrivate ){ |
| 647 | autosync(AUTOSYNC_PULL); |
| 648 | } |
| 649 | |
| 650 | /* There are two ways this command may be executed. If there are |
| 651 | ** no arguments following the word "commit", then all modified files |
| 652 | ** in the checked out directory are committed. If one or more arguments |
| 653 | ** follows "commit", then only those files are committed. |
| 654 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -644,10 +644,22 @@ | |
| 644 | ** Autosync if autosync is enabled and this is not a private check-in. |
| 645 | */ |
| 646 | if( !g.markPrivate ){ |
| 647 | autosync(AUTOSYNC_PULL); |
| 648 | } |
| 649 | |
| 650 | /* Require confirmation to continue with the check-in if there is |
| 651 | ** clock skew |
| 652 | */ |
| 653 | if( g.clockSkewSeen ){ |
| 654 | Blob ans; |
| 655 | blob_zero(&ans); |
| 656 | prompt_user("continue in spite of time skew (y/N)? ", &ans); |
| 657 | if( blob_str(&ans)[0]!='y' ){ |
| 658 | fossil_exit(1); |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | /* There are two ways this command may be executed. If there are |
| 663 | ** no arguments following the word "commit", then all modified files |
| 664 | ** in the checked out directory are committed. If one or more arguments |
| 665 | ** follows "commit", then only those files are committed. |
| 666 |
+1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -83,10 +83,11 @@ | ||
| 83 | 83 | FILE *httpOut; /* Send HTTP output here */ |
| 84 | 84 | int xlinkClusterOnly; /* Set when cloning. Only process clusters */ |
| 85 | 85 | int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ |
| 86 | 86 | int *aCommitFile; /* Array of files to be committed */ |
| 87 | 87 | int markPrivate; /* All new artifacts are private if true */ |
| 88 | + int clockSkewSeen; /* True if clocks on client and server out of sync */ | |
| 88 | 89 | |
| 89 | 90 | int urlIsFile; /* True if a "file:" url */ |
| 90 | 91 | int urlIsHttps; /* True if a "https:" url */ |
| 91 | 92 | int urlIsSsh; /* True if an "ssh:" url */ |
| 92 | 93 | char *urlName; /* Hostname for http: or filename for file: */ |
| 93 | 94 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -83,10 +83,11 @@ | |
| 83 | FILE *httpOut; /* Send HTTP output here */ |
| 84 | int xlinkClusterOnly; /* Set when cloning. Only process clusters */ |
| 85 | int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ |
| 86 | int *aCommitFile; /* Array of files to be committed */ |
| 87 | int markPrivate; /* All new artifacts are private if true */ |
| 88 | |
| 89 | int urlIsFile; /* True if a "file:" url */ |
| 90 | int urlIsHttps; /* True if a "https:" url */ |
| 91 | int urlIsSsh; /* True if an "ssh:" url */ |
| 92 | char *urlName; /* Hostname for http: or filename for file: */ |
| 93 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -83,10 +83,11 @@ | |
| 83 | FILE *httpOut; /* Send HTTP output here */ |
| 84 | int xlinkClusterOnly; /* Set when cloning. Only process clusters */ |
| 85 | int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ |
| 86 | int *aCommitFile; /* Array of files to be committed */ |
| 87 | int markPrivate; /* All new artifacts are private if true */ |
| 88 | int clockSkewSeen; /* True if clocks on client and server out of sync */ |
| 89 | |
| 90 | int urlIsFile; /* True if a "file:" url */ |
| 91 | int urlIsHttps; /* True if a "https:" url */ |
| 92 | int urlIsSsh; /* True if an "ssh:" url */ |
| 93 | char *urlName; /* Hostname for http: or filename for file: */ |
| 94 |
+1
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1097,10 +1097,11 @@ | ||
| 1097 | 1097 | if( rDiff<0.0 ) rDiff = -rDiff; |
| 1098 | 1098 | if( rDiff>9e98 ) rDiff = 0.0; |
| 1099 | 1099 | if( (rDiff*24.0*3600.0)>=60.0 ){ |
| 1100 | 1100 | fossil_warning("*** time skew *** server time differs by %s", |
| 1101 | 1101 | db_timespan_name(rDiff)); |
| 1102 | + g.clockSkewSeen = 1; | |
| 1102 | 1103 | } |
| 1103 | 1104 | } |
| 1104 | 1105 | continue; |
| 1105 | 1106 | } |
| 1106 | 1107 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1107 | 1108 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1097,10 +1097,11 @@ | |
| 1097 | if( rDiff<0.0 ) rDiff = -rDiff; |
| 1098 | if( rDiff>9e98 ) rDiff = 0.0; |
| 1099 | if( (rDiff*24.0*3600.0)>=60.0 ){ |
| 1100 | fossil_warning("*** time skew *** server time differs by %s", |
| 1101 | db_timespan_name(rDiff)); |
| 1102 | } |
| 1103 | } |
| 1104 | continue; |
| 1105 | } |
| 1106 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1107 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1097,10 +1097,11 @@ | |
| 1097 | if( rDiff<0.0 ) rDiff = -rDiff; |
| 1098 | if( rDiff>9e98 ) rDiff = 0.0; |
| 1099 | if( (rDiff*24.0*3600.0)>=60.0 ){ |
| 1100 | fossil_warning("*** time skew *** server time differs by %s", |
| 1101 | db_timespan_name(rDiff)); |
| 1102 | g.clockSkewSeen = 1; |
| 1103 | } |
| 1104 | } |
| 1105 | continue; |
| 1106 | } |
| 1107 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1108 |