Fossil SCM

Show an error if unrecognized command-line options appear on the commit command. Also add the (undocumented) "omit-ci-sig" configuration option on the database. Setting omit-ci-sig omits the PGP signature on check-in.

drh 2007-08-03 23:30 trunk
Commit 6aff11f03f25f00b6ec3c3233fb6426fc2ae8b4a
2 files changed +4 -1 +14
+4 -1
--- src/checkin.c
+++ src/checkin.c
@@ -266,17 +266,20 @@
266266
int vid, nrid, nvid;
267267
Blob comment;
268268
Stmt q;
269269
Stmt q2;
270270
char *zUuid, *zDate;
271
+ int noSign = 0; /* True to omit signing the manifest using GPG */
271272
char *zManifestFile; /* Name of the manifest file */
272273
Blob manifest;
273274
Blob mcksum; /* Self-checksum on the manifest */
274275
Blob cksum1, cksum2; /* Before and after commit checksums */
275276
Blob cksum1b; /* Checksum recorded in the manifest */
276277
277278
db_must_be_within_tree();
279
+ noSign = db_get_int("omit-ci-sig", 0);
280
+ verify_all_options();
278281
279282
/* There are two ways this command may be executed. If there are
280283
** no arguments following the word "commit", then all modified files
281284
** in the checked out directory are committed. If one or more arguments
282285
** follows "commit", then only those files are committed.
@@ -377,11 +380,11 @@
377380
blob_appendf(&manifest, "R %b\n", &cksum1);
378381
blob_appendf(&manifest, "U %F\n", g.zLogin);
379382
md5sum_blob(&manifest, &mcksum);
380383
blob_appendf(&manifest, "Z %b\n", &mcksum);
381384
zManifestFile = mprintf("%smanifest", g.zLocalRoot);
382
- if( clearsign(&manifest, &manifest) ){
385
+ if( !noSign && clearsign(&manifest, &manifest) ){
383386
Blob ans;
384387
blob_zero(&ans);
385388
prompt_user("unable to sign manifest. continue [y/N]? ", &ans);
386389
if( blob_str(&ans)[0]!='y' ){
387390
db_end_transaction(1);
388391
--- src/checkin.c
+++ src/checkin.c
@@ -266,17 +266,20 @@
266 int vid, nrid, nvid;
267 Blob comment;
268 Stmt q;
269 Stmt q2;
270 char *zUuid, *zDate;
 
271 char *zManifestFile; /* Name of the manifest file */
272 Blob manifest;
273 Blob mcksum; /* Self-checksum on the manifest */
274 Blob cksum1, cksum2; /* Before and after commit checksums */
275 Blob cksum1b; /* Checksum recorded in the manifest */
276
277 db_must_be_within_tree();
 
 
278
279 /* There are two ways this command may be executed. If there are
280 ** no arguments following the word "commit", then all modified files
281 ** in the checked out directory are committed. If one or more arguments
282 ** follows "commit", then only those files are committed.
@@ -377,11 +380,11 @@
377 blob_appendf(&manifest, "R %b\n", &cksum1);
378 blob_appendf(&manifest, "U %F\n", g.zLogin);
379 md5sum_blob(&manifest, &mcksum);
380 blob_appendf(&manifest, "Z %b\n", &mcksum);
381 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
382 if( clearsign(&manifest, &manifest) ){
383 Blob ans;
384 blob_zero(&ans);
385 prompt_user("unable to sign manifest. continue [y/N]? ", &ans);
386 if( blob_str(&ans)[0]!='y' ){
387 db_end_transaction(1);
388
--- src/checkin.c
+++ src/checkin.c
@@ -266,17 +266,20 @@
266 int vid, nrid, nvid;
267 Blob comment;
268 Stmt q;
269 Stmt q2;
270 char *zUuid, *zDate;
271 int noSign = 0; /* True to omit signing the manifest using GPG */
272 char *zManifestFile; /* Name of the manifest file */
273 Blob manifest;
274 Blob mcksum; /* Self-checksum on the manifest */
275 Blob cksum1, cksum2; /* Before and after commit checksums */
276 Blob cksum1b; /* Checksum recorded in the manifest */
277
278 db_must_be_within_tree();
279 noSign = db_get_int("omit-ci-sig", 0);
280 verify_all_options();
281
282 /* There are two ways this command may be executed. If there are
283 ** no arguments following the word "commit", then all modified files
284 ** in the checked out directory are committed. If one or more arguments
285 ** follows "commit", then only those files are committed.
@@ -377,11 +380,11 @@
380 blob_appendf(&manifest, "R %b\n", &cksum1);
381 blob_appendf(&manifest, "U %F\n", g.zLogin);
382 md5sum_blob(&manifest, &mcksum);
383 blob_appendf(&manifest, "Z %b\n", &mcksum);
384 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
385 if( !noSign && clearsign(&manifest, &manifest) ){
386 Blob ans;
387 blob_zero(&ans);
388 prompt_user("unable to sign manifest. continue [y/N]? ", &ans);
389 if( blob_str(&ans)[0]!='y' ){
390 db_end_transaction(1);
391
+14
--- src/main.c
+++ src/main.c
@@ -297,10 +297,24 @@
297297
break;
298298
}
299299
}
300300
return zReturn;
301301
}
302
+
303
+/*
304
+** Verify that there are no processed command-line options. If
305
+** Any remaining command-line argument begins with "-" print
306
+** an error message and quit.
307
+*/
308
+void verify_all_options(void){
309
+ int i;
310
+ for(i=1; i<g.argc; i++){
311
+ if( g.argv[i][0]=='-' ){
312
+ fossil_fatal("unrecognized command-line option: %s", g.argv[i]);
313
+ }
314
+ }
315
+}
302316
303317
/*
304318
** Print a list of words in multiple columns.
305319
*/
306320
static void multi_column_list(const char **azWord, int nWord){
307321
--- src/main.c
+++ src/main.c
@@ -297,10 +297,24 @@
297 break;
298 }
299 }
300 return zReturn;
301 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
303 /*
304 ** Print a list of words in multiple columns.
305 */
306 static void multi_column_list(const char **azWord, int nWord){
307
--- src/main.c
+++ src/main.c
@@ -297,10 +297,24 @@
297 break;
298 }
299 }
300 return zReturn;
301 }
302
303 /*
304 ** Verify that there are no processed command-line options. If
305 ** Any remaining command-line argument begins with "-" print
306 ** an error message and quit.
307 */
308 void verify_all_options(void){
309 int i;
310 for(i=1; i<g.argc; i++){
311 if( g.argv[i][0]=='-' ){
312 fossil_fatal("unrecognized command-line option: %s", g.argv[i]);
313 }
314 }
315 }
316
317 /*
318 ** Print a list of words in multiple columns.
319 */
320 static void multi_column_list(const char **azWord, int nWord){
321

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button