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.
Commit
6aff11f03f25f00b6ec3c3233fb6426fc2ae8b4a
Parent
22552fb803cfa78…
2 files changed
+4
-1
+14
+4
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -266,17 +266,20 @@ | ||
| 266 | 266 | int vid, nrid, nvid; |
| 267 | 267 | Blob comment; |
| 268 | 268 | Stmt q; |
| 269 | 269 | Stmt q2; |
| 270 | 270 | char *zUuid, *zDate; |
| 271 | + int noSign = 0; /* True to omit signing the manifest using GPG */ | |
| 271 | 272 | char *zManifestFile; /* Name of the manifest file */ |
| 272 | 273 | Blob manifest; |
| 273 | 274 | Blob mcksum; /* Self-checksum on the manifest */ |
| 274 | 275 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 275 | 276 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 276 | 277 | |
| 277 | 278 | db_must_be_within_tree(); |
| 279 | + noSign = db_get_int("omit-ci-sig", 0); | |
| 280 | + verify_all_options(); | |
| 278 | 281 | |
| 279 | 282 | /* There are two ways this command may be executed. If there are |
| 280 | 283 | ** no arguments following the word "commit", then all modified files |
| 281 | 284 | ** in the checked out directory are committed. If one or more arguments |
| 282 | 285 | ** follows "commit", then only those files are committed. |
| @@ -377,11 +380,11 @@ | ||
| 377 | 380 | blob_appendf(&manifest, "R %b\n", &cksum1); |
| 378 | 381 | blob_appendf(&manifest, "U %F\n", g.zLogin); |
| 379 | 382 | md5sum_blob(&manifest, &mcksum); |
| 380 | 383 | blob_appendf(&manifest, "Z %b\n", &mcksum); |
| 381 | 384 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| 382 | - if( clearsign(&manifest, &manifest) ){ | |
| 385 | + if( !noSign && clearsign(&manifest, &manifest) ){ | |
| 383 | 386 | Blob ans; |
| 384 | 387 | blob_zero(&ans); |
| 385 | 388 | prompt_user("unable to sign manifest. continue [y/N]? ", &ans); |
| 386 | 389 | if( blob_str(&ans)[0]!='y' ){ |
| 387 | 390 | db_end_transaction(1); |
| 388 | 391 |
| --- 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 @@ | ||
| 297 | 297 | break; |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | return zReturn; |
| 301 | 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 | +} | |
| 302 | 316 | |
| 303 | 317 | /* |
| 304 | 318 | ** Print a list of words in multiple columns. |
| 305 | 319 | */ |
| 306 | 320 | static void multi_column_list(const char **azWord, int nWord){ |
| 307 | 321 |
| --- 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 |