Fossil SCM
Merge the fix for [711d04b6d8577] into trunk. Only bail out of a commit if none of the selected files have changed, rather than if any selected file is unchanged.
Commit
3a5e81cedb0bd2c745ecdb6c32ed480dc8f610e0
Parent
1048bccf14a3da7…
1 file changed
+11
-13
+11
-13
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1084,24 +1084,22 @@ | ||
| 1084 | 1084 | db_record_repository_filename(0); |
| 1085 | 1085 | if( hasChanges==0 && !isAMerge && !forceFlag ){ |
| 1086 | 1086 | fossil_fatal("nothing has changed"); |
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | - /* If one or more files that were named on the command line have not | |
| 1090 | - ** been modified, bail out now. | |
| 1089 | + /* If none of the files that were named on the command line have | |
| 1090 | + ** been modified, bail out now unless the --force flag is used. | |
| 1091 | 1091 | */ |
| 1092 | - if( g.aCommitFile ){ | |
| 1093 | - Blob unmodified; | |
| 1094 | - memset(&unmodified, 0, sizeof(Blob)); | |
| 1095 | - blob_init(&unmodified, 0, 0); | |
| 1096 | - db_blob(&unmodified, | |
| 1097 | - "SELECT pathname FROM vfile" | |
| 1098 | - " WHERE chnged = 0 AND origname IS NULL AND is_selected(id)" | |
| 1099 | - ); | |
| 1100 | - if( strlen(blob_str(&unmodified)) ){ | |
| 1101 | - fossil_fatal("file %s has not changed", blob_str(&unmodified)); | |
| 1102 | - } | |
| 1092 | + if( g.aCommitFile | |
| 1093 | + && !forceFlag | |
| 1094 | + && !db_exists( | |
| 1095 | + "SELECT 1 FROM vfile " | |
| 1096 | + " WHERE is_selected(id)" | |
| 1097 | + " AND (chnged OR deleted OR rid=0 OR pathname!=origname)") | |
| 1098 | + ){ | |
| 1099 | + fossil_fatal("none of the selected files have changed; use -f" | |
| 1100 | + " or --force."); | |
| 1103 | 1101 | } |
| 1104 | 1102 | |
| 1105 | 1103 | /* |
| 1106 | 1104 | ** Do not allow a commit that will cause a fork unless the --force flag |
| 1107 | 1105 | ** is used or unless this is a private check-in. |
| 1108 | 1106 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1084,24 +1084,22 @@ | |
| 1084 | db_record_repository_filename(0); |
| 1085 | if( hasChanges==0 && !isAMerge && !forceFlag ){ |
| 1086 | fossil_fatal("nothing has changed"); |
| 1087 | } |
| 1088 | |
| 1089 | /* If one or more files that were named on the command line have not |
| 1090 | ** been modified, bail out now. |
| 1091 | */ |
| 1092 | if( g.aCommitFile ){ |
| 1093 | Blob unmodified; |
| 1094 | memset(&unmodified, 0, sizeof(Blob)); |
| 1095 | blob_init(&unmodified, 0, 0); |
| 1096 | db_blob(&unmodified, |
| 1097 | "SELECT pathname FROM vfile" |
| 1098 | " WHERE chnged = 0 AND origname IS NULL AND is_selected(id)" |
| 1099 | ); |
| 1100 | if( strlen(blob_str(&unmodified)) ){ |
| 1101 | fossil_fatal("file %s has not changed", blob_str(&unmodified)); |
| 1102 | } |
| 1103 | } |
| 1104 | |
| 1105 | /* |
| 1106 | ** Do not allow a commit that will cause a fork unless the --force flag |
| 1107 | ** is used or unless this is a private check-in. |
| 1108 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1084,24 +1084,22 @@ | |
| 1084 | db_record_repository_filename(0); |
| 1085 | if( hasChanges==0 && !isAMerge && !forceFlag ){ |
| 1086 | fossil_fatal("nothing has changed"); |
| 1087 | } |
| 1088 | |
| 1089 | /* If none of the files that were named on the command line have |
| 1090 | ** been modified, bail out now unless the --force flag is used. |
| 1091 | */ |
| 1092 | if( g.aCommitFile |
| 1093 | && !forceFlag |
| 1094 | && !db_exists( |
| 1095 | "SELECT 1 FROM vfile " |
| 1096 | " WHERE is_selected(id)" |
| 1097 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname)") |
| 1098 | ){ |
| 1099 | fossil_fatal("none of the selected files have changed; use -f" |
| 1100 | " or --force."); |
| 1101 | } |
| 1102 | |
| 1103 | /* |
| 1104 | ** Do not allow a commit that will cause a fork unless the --force flag |
| 1105 | ** is used or unless this is a private check-in. |
| 1106 |