Fossil SCM
rebase
Commit
dfb47a2a2e0f5dacf10ad8e1f1e5d3845df4593a
Parent
c0b98195f9c7dcb…
12 files changed
-14
+17
+17
+8
-27
+52
-28
+52
-28
-1
+7
-8
+7
-8
-1
+5
-8
+5
-8
D
.fossil-settings/clean-glob
-14
| --- a/.fossil-settings/clean-glob | ||
| +++ b/.fossil-settings/clean-glob | ||
| @@ -1,14 +0,0 @@ | ||
| 1 | -*.a | |
| 2 | -*.lib | |
| 3 | -*.manifest | |
| 4 | -*.o | |
| 5 | -bld/* | |
| 6 | -w.a | |
| 7 | -*.lib | |
| 8 | -*.manifest | |
| 9 | -*.o | |
| 10 | -*.obj | |
| 11 | -*.pdb | |
| 12 | -*.res | |
| 13 | -Makefile | |
| 14 | -aut |
| --- a/.fossil-settings/clean-glob | |
| +++ b/.fossil-settings/clean-glob | |
| @@ -1,14 +0,0 @@ | |
| 1 | *.a |
| 2 | *.lib |
| 3 | *.manifest |
| 4 | *.o |
| 5 | bld/* |
| 6 | w.a |
| 7 | *.lib |
| 8 | *.manifest |
| 9 | *.o |
| 10 | *.obj |
| 11 | *.pdb |
| 12 | *.res |
| 13 | Makefile |
| 14 | aut |
| --- a/.fossil-settings/clean-glob | |
| +++ b/.fossil-settings/clean-glob | |
| @@ -1,14 +0,0 @@ | |
| --- .fossil-settings/ignore-glob | ||
| +++ .fossil-settings/ignore-glob | ||
| @@ -1,4 +1,21 @@ | ||
| 1 | 1 | compat/openssl* |
| 2 | 2 | compat/tcl* |
| 3 | +*.a | |
| 4 | +*.lib | |
| 5 | +*.manifest | |
| 6 | +*.o | |
| 7 | +*.obj | |
| 8 | +*.pdb | |
| 9 | +*.res | |
| 10 | +Makefile | |
| 11 | +bld/* | |
| 12 | +wbld/* | |
| 13 | +win/*.c | |
| 14 | +win/*.h | |
| 15 | +win/*.exe | |
| 16 | +win/headers | |
| 17 | +win/linkopts | |
| 18 | +autoconfig.h | |
| 19 | +config.log | |
| 3 | 20 | fossil |
| 4 | 21 | fossil.exe |
| 5 | 22 |
| --- .fossil-settings/ignore-glob | |
| +++ .fossil-settings/ignore-glob | |
| @@ -1,4 +1,21 @@ | |
| 1 | compat/openssl* |
| 2 | compat/tcl* |
| 3 | fossil |
| 4 | fossil.exe |
| 5 |
| --- .fossil-settings/ignore-glob | |
| +++ .fossil-settings/ignore-glob | |
| @@ -1,4 +1,21 @@ | |
| 1 | compat/openssl* |
| 2 | compat/tcl* |
| 3 | *.a |
| 4 | *.lib |
| 5 | *.manifest |
| 6 | *.o |
| 7 | *.obj |
| 8 | *.pdb |
| 9 | *.res |
| 10 | Makefile |
| 11 | bld/* |
| 12 | wbld/* |
| 13 | win/*.c |
| 14 | win/*.h |
| 15 | win/*.exe |
| 16 | win/headers |
| 17 | win/linkopts |
| 18 | autoconfig.h |
| 19 | config.log |
| 20 | fossil |
| 21 | fossil.exe |
| 22 |
| --- .fossil-settings/ignore-glob | ||
| +++ .fossil-settings/ignore-glob | ||
| @@ -1,4 +1,21 @@ | ||
| 1 | 1 | compat/openssl* |
| 2 | 2 | compat/tcl* |
| 3 | +*.a | |
| 4 | +*.lib | |
| 5 | +*.manifest | |
| 6 | +*.o | |
| 7 | +*.obj | |
| 8 | +*.pdb | |
| 9 | +*.res | |
| 10 | +Makefile | |
| 11 | +bld/* | |
| 12 | +wbld/* | |
| 13 | +win/*.c | |
| 14 | +win/*.h | |
| 15 | +win/*.exe | |
| 16 | +win/headers | |
| 17 | +win/linkopts | |
| 18 | +autoconfig.h | |
| 19 | +config.log | |
| 3 | 20 | fossil |
| 4 | 21 | fossil.exe |
| 5 | 22 |
| --- .fossil-settings/ignore-glob | |
| +++ .fossil-settings/ignore-glob | |
| @@ -1,4 +1,21 @@ | |
| 1 | compat/openssl* |
| 2 | compat/tcl* |
| 3 | fossil |
| 4 | fossil.exe |
| 5 |
| --- .fossil-settings/ignore-glob | |
| +++ .fossil-settings/ignore-glob | |
| @@ -1,4 +1,21 @@ | |
| 1 | compat/openssl* |
| 2 | compat/tcl* |
| 3 | *.a |
| 4 | *.lib |
| 5 | *.manifest |
| 6 | *.o |
| 7 | *.obj |
| 8 | *.pdb |
| 9 | *.res |
| 10 | Makefile |
| 11 | bld/* |
| 12 | wbld/* |
| 13 | win/*.c |
| 14 | win/*.h |
| 15 | win/*.exe |
| 16 | win/headers |
| 17 | win/linkopts |
| 18 | autoconfig.h |
| 19 | config.log |
| 20 | fossil |
| 21 | fossil.exe |
| 22 |
+8
-27
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -221,15 +221,14 @@ | ||
| 221 | 221 | ** |
| 222 | 222 | ** When adding files or directories recursively, filenames that begin |
| 223 | 223 | ** with "." are excluded by default. To include such files, add |
| 224 | 224 | ** the "--dotfiles" option to the command-line. |
| 225 | 225 | ** |
| 226 | -** The --ignore and --clean options are comma-separate lists of glob patterns | |
| 226 | +** The --ignore option is a comma-separate lists of glob patterns | |
| 227 | 227 | ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore |
| 228 | 228 | ** option does not appear on the command line then the "ignore-glob" setting |
| 229 | -** is used. If the --clean option does not appear on the command line then | |
| 230 | -** the "clean-glob" setting is used. | |
| 229 | +** is used. | |
| 231 | 230 | ** |
| 232 | 231 | ** The --case-sensitive option determines whether or not filenames should |
| 233 | 232 | ** be treated case sensitive or not. If the option is not given, the default |
| 234 | 233 | ** depends on the global setting, or the operating system default, if not set. |
| 235 | 234 | ** |
| @@ -237,32 +236,25 @@ | ||
| 237 | 236 | ** |
| 238 | 237 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 239 | 238 | ** --dotfiles include files beginning with a dot (".") |
| 240 | 239 | ** --ignore <CSG> ignore files matching patterns from the |
| 241 | 240 | ** comma separated list of glob patterns. |
| 242 | -** --clean <CSG> also ignore files matching patterns from | |
| 243 | -** the comma separated list of glob patterns. | |
| 244 | 241 | ** |
| 245 | 242 | ** See also: addremove, rm |
| 246 | 243 | */ |
| 247 | 244 | void add_cmd(void){ |
| 248 | 245 | int i; /* Loop counter */ |
| 249 | 246 | int vid; /* Currently checked out version */ |
| 250 | 247 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 251 | - const char *zCleanFlag; /* The --clean option or clean-glob setting */ | |
| 252 | 248 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 253 | - Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ | |
| 249 | + Glob *pIgnore; /* Ignore everything matching the glob patterns */ | |
| 254 | 250 | unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ |
| 255 | 251 | |
| 256 | - zCleanFlag = find_option("clean",0,1); | |
| 257 | 252 | zIgnoreFlag = find_option("ignore",0,1); |
| 258 | 253 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 259 | 254 | capture_case_sensitive_option(); |
| 260 | 255 | db_must_be_within_tree(); |
| 261 | - if( zCleanFlag==0 ){ | |
| 262 | - zCleanFlag = db_get("clean-glob", 0); | |
| 263 | - } | |
| 264 | 256 | if( zIgnoreFlag==0 ){ |
| 265 | 257 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 266 | 258 | } |
| 267 | 259 | vid = db_lget_int("checkout",0); |
| 268 | 260 | if( vid==0 ){ |
| @@ -269,11 +261,10 @@ | ||
| 269 | 261 | fossil_panic("no checkout to add to"); |
| 270 | 262 | } |
| 271 | 263 | db_begin_transaction(); |
| 272 | 264 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 273 | 265 | filename_collation()); |
| 274 | - pClean = glob_create(zCleanFlag); | |
| 275 | 266 | pIgnore = glob_create(zIgnoreFlag); |
| 276 | 267 | nRoot = strlen(g.zLocalRoot); |
| 277 | 268 | |
| 278 | 269 | /* Load the names of all files that are to be added into sfile temp table */ |
| 279 | 270 | for(i=2; i<g.argc; i++){ |
| @@ -283,11 +274,11 @@ | ||
| 283 | 274 | |
| 284 | 275 | file_canonical_name(g.argv[i], &fullName, 0); |
| 285 | 276 | zName = blob_str(&fullName); |
| 286 | 277 | isDir = file_wd_isdir(zName); |
| 287 | 278 | if( isDir==1 ){ |
| 288 | - vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore); | |
| 279 | + vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore); | |
| 289 | 280 | }else if( isDir==0 ){ |
| 290 | 281 | fossil_warning("not found: %s", zName); |
| 291 | 282 | }else if( file_access(zName, R_OK) ){ |
| 292 | 283 | fossil_fatal("cannot open %s", zName); |
| 293 | 284 | }else{ |
| @@ -298,11 +289,10 @@ | ||
| 298 | 289 | ); |
| 299 | 290 | } |
| 300 | 291 | blob_reset(&fullName); |
| 301 | 292 | } |
| 302 | 293 | glob_free(pIgnore); |
| 303 | - glob_free(pClean); | |
| 304 | 294 | |
| 305 | 295 | add_files_in_sfile(vid); |
| 306 | 296 | db_end_transaction(0); |
| 307 | 297 | } |
| 308 | 298 | |
| @@ -461,13 +451,12 @@ | ||
| 461 | 451 | ** |
| 462 | 452 | ** Files and directories whose names begin with "." are ignored unless |
| 463 | 453 | ** the --dotfiles option is used. |
| 464 | 454 | ** |
| 465 | 455 | ** The --ignore option overrides the "ignore-glob" setting, as do the |
| 466 | -** --case-sensitive option with the "case-sensitive" setting and the | |
| 467 | -** --clean option with the "clean-glob" setting. See the documentation | |
| 468 | -** on the "settings" command for further information. | |
| 456 | +** --case-sensitive option with the "case-sensitive" setting. See the | |
| 457 | +** documentation on the "settings" command for further information. | |
| 469 | 458 | ** |
| 470 | 459 | ** The -n|--dry-run option shows what would happen without actually doing anything. |
| 471 | 460 | ** |
| 472 | 461 | ** This command can be used to track third party software. |
| 473 | 462 | ** |
| @@ -474,37 +463,31 @@ | ||
| 474 | 463 | ** Options: |
| 475 | 464 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 476 | 465 | ** --dotfiles include files beginning with a dot (".") |
| 477 | 466 | ** --ignore <CSG> ignore files matching patterns from the |
| 478 | 467 | ** comma separated list of glob patterns. |
| 479 | -** --clean <CSG> also ignore files matching patterns from | |
| 480 | -** the comma separated list of glob patterns. | |
| 481 | 468 | ** -n|--dry-run If given, display instead of run actions |
| 482 | 469 | ** |
| 483 | 470 | ** See also: add, rm |
| 484 | 471 | */ |
| 485 | 472 | void addremove_cmd(void){ |
| 486 | 473 | Blob path; |
| 487 | - const char *zCleanFlag = find_option("clean",0,1); | |
| 488 | 474 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 489 | 475 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 490 | 476 | int dryRunFlag = find_option("dry-run","n",0)!=0; |
| 491 | 477 | int n; |
| 492 | 478 | Stmt q; |
| 493 | 479 | int vid; |
| 494 | 480 | int nAdd = 0; |
| 495 | 481 | int nDelete = 0; |
| 496 | - Glob *pIgnore, *pClean; | |
| 482 | + Glob *pIgnore; | |
| 497 | 483 | |
| 498 | 484 | if( !dryRunFlag ){ |
| 499 | 485 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 500 | 486 | } |
| 501 | 487 | capture_case_sensitive_option(); |
| 502 | 488 | db_must_be_within_tree(); |
| 503 | - if( zCleanFlag==0 ){ | |
| 504 | - zCleanFlag = db_get("clean-glob", 0); | |
| 505 | - } | |
| 506 | 489 | if( zIgnoreFlag==0 ){ |
| 507 | 490 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 508 | 491 | } |
| 509 | 492 | vid = db_lget_int("checkout",0); |
| 510 | 493 | if( vid==0 ){ |
| @@ -521,15 +504,13 @@ | ||
| 521 | 504 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 522 | 505 | filename_collation()); |
| 523 | 506 | n = strlen(g.zLocalRoot); |
| 524 | 507 | blob_init(&path, g.zLocalRoot, n-1); |
| 525 | 508 | /* now we read the complete file structure into a temp table */ |
| 526 | - pClean = glob_create(zCleanFlag); | |
| 527 | 509 | pIgnore = glob_create(zIgnoreFlag); |
| 528 | - vfile_scan(&path, blob_size(&path), scanFlags, pClean, pIgnore); | |
| 510 | + vfile_scan(&path, blob_size(&path), scanFlags, pIgnore); | |
| 529 | 511 | glob_free(pIgnore); |
| 530 | - glob_free(pClean); | |
| 531 | 512 | nAdd = add_files_in_sfile(vid); |
| 532 | 513 | |
| 533 | 514 | /* step 2: search for missing files */ |
| 534 | 515 | db_prepare(&q, |
| 535 | 516 | "SELECT pathname, %Q || pathname, deleted FROM vfile" |
| 536 | 517 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -221,15 +221,14 @@ | |
| 221 | ** |
| 222 | ** When adding files or directories recursively, filenames that begin |
| 223 | ** with "." are excluded by default. To include such files, add |
| 224 | ** the "--dotfiles" option to the command-line. |
| 225 | ** |
| 226 | ** The --ignore and --clean options are comma-separate lists of glob patterns |
| 227 | ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore |
| 228 | ** option does not appear on the command line then the "ignore-glob" setting |
| 229 | ** is used. If the --clean option does not appear on the command line then |
| 230 | ** the "clean-glob" setting is used. |
| 231 | ** |
| 232 | ** The --case-sensitive option determines whether or not filenames should |
| 233 | ** be treated case sensitive or not. If the option is not given, the default |
| 234 | ** depends on the global setting, or the operating system default, if not set. |
| 235 | ** |
| @@ -237,32 +236,25 @@ | |
| 237 | ** |
| 238 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 239 | ** --dotfiles include files beginning with a dot (".") |
| 240 | ** --ignore <CSG> ignore files matching patterns from the |
| 241 | ** comma separated list of glob patterns. |
| 242 | ** --clean <CSG> also ignore files matching patterns from |
| 243 | ** the comma separated list of glob patterns. |
| 244 | ** |
| 245 | ** See also: addremove, rm |
| 246 | */ |
| 247 | void add_cmd(void){ |
| 248 | int i; /* Loop counter */ |
| 249 | int vid; /* Currently checked out version */ |
| 250 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 251 | const char *zCleanFlag; /* The --clean option or clean-glob setting */ |
| 252 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 253 | Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ |
| 254 | unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ |
| 255 | |
| 256 | zCleanFlag = find_option("clean",0,1); |
| 257 | zIgnoreFlag = find_option("ignore",0,1); |
| 258 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 259 | capture_case_sensitive_option(); |
| 260 | db_must_be_within_tree(); |
| 261 | if( zCleanFlag==0 ){ |
| 262 | zCleanFlag = db_get("clean-glob", 0); |
| 263 | } |
| 264 | if( zIgnoreFlag==0 ){ |
| 265 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 266 | } |
| 267 | vid = db_lget_int("checkout",0); |
| 268 | if( vid==0 ){ |
| @@ -269,11 +261,10 @@ | |
| 269 | fossil_panic("no checkout to add to"); |
| 270 | } |
| 271 | db_begin_transaction(); |
| 272 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 273 | filename_collation()); |
| 274 | pClean = glob_create(zCleanFlag); |
| 275 | pIgnore = glob_create(zIgnoreFlag); |
| 276 | nRoot = strlen(g.zLocalRoot); |
| 277 | |
| 278 | /* Load the names of all files that are to be added into sfile temp table */ |
| 279 | for(i=2; i<g.argc; i++){ |
| @@ -283,11 +274,11 @@ | |
| 283 | |
| 284 | file_canonical_name(g.argv[i], &fullName, 0); |
| 285 | zName = blob_str(&fullName); |
| 286 | isDir = file_wd_isdir(zName); |
| 287 | if( isDir==1 ){ |
| 288 | vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore); |
| 289 | }else if( isDir==0 ){ |
| 290 | fossil_warning("not found: %s", zName); |
| 291 | }else if( file_access(zName, R_OK) ){ |
| 292 | fossil_fatal("cannot open %s", zName); |
| 293 | }else{ |
| @@ -298,11 +289,10 @@ | |
| 298 | ); |
| 299 | } |
| 300 | blob_reset(&fullName); |
| 301 | } |
| 302 | glob_free(pIgnore); |
| 303 | glob_free(pClean); |
| 304 | |
| 305 | add_files_in_sfile(vid); |
| 306 | db_end_transaction(0); |
| 307 | } |
| 308 | |
| @@ -461,13 +451,12 @@ | |
| 461 | ** |
| 462 | ** Files and directories whose names begin with "." are ignored unless |
| 463 | ** the --dotfiles option is used. |
| 464 | ** |
| 465 | ** The --ignore option overrides the "ignore-glob" setting, as do the |
| 466 | ** --case-sensitive option with the "case-sensitive" setting and the |
| 467 | ** --clean option with the "clean-glob" setting. See the documentation |
| 468 | ** on the "settings" command for further information. |
| 469 | ** |
| 470 | ** The -n|--dry-run option shows what would happen without actually doing anything. |
| 471 | ** |
| 472 | ** This command can be used to track third party software. |
| 473 | ** |
| @@ -474,37 +463,31 @@ | |
| 474 | ** Options: |
| 475 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 476 | ** --dotfiles include files beginning with a dot (".") |
| 477 | ** --ignore <CSG> ignore files matching patterns from the |
| 478 | ** comma separated list of glob patterns. |
| 479 | ** --clean <CSG> also ignore files matching patterns from |
| 480 | ** the comma separated list of glob patterns. |
| 481 | ** -n|--dry-run If given, display instead of run actions |
| 482 | ** |
| 483 | ** See also: add, rm |
| 484 | */ |
| 485 | void addremove_cmd(void){ |
| 486 | Blob path; |
| 487 | const char *zCleanFlag = find_option("clean",0,1); |
| 488 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 489 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 490 | int dryRunFlag = find_option("dry-run","n",0)!=0; |
| 491 | int n; |
| 492 | Stmt q; |
| 493 | int vid; |
| 494 | int nAdd = 0; |
| 495 | int nDelete = 0; |
| 496 | Glob *pIgnore, *pClean; |
| 497 | |
| 498 | if( !dryRunFlag ){ |
| 499 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 500 | } |
| 501 | capture_case_sensitive_option(); |
| 502 | db_must_be_within_tree(); |
| 503 | if( zCleanFlag==0 ){ |
| 504 | zCleanFlag = db_get("clean-glob", 0); |
| 505 | } |
| 506 | if( zIgnoreFlag==0 ){ |
| 507 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 508 | } |
| 509 | vid = db_lget_int("checkout",0); |
| 510 | if( vid==0 ){ |
| @@ -521,15 +504,13 @@ | |
| 521 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 522 | filename_collation()); |
| 523 | n = strlen(g.zLocalRoot); |
| 524 | blob_init(&path, g.zLocalRoot, n-1); |
| 525 | /* now we read the complete file structure into a temp table */ |
| 526 | pClean = glob_create(zCleanFlag); |
| 527 | pIgnore = glob_create(zIgnoreFlag); |
| 528 | vfile_scan(&path, blob_size(&path), scanFlags, pClean, pIgnore); |
| 529 | glob_free(pIgnore); |
| 530 | glob_free(pClean); |
| 531 | nAdd = add_files_in_sfile(vid); |
| 532 | |
| 533 | /* step 2: search for missing files */ |
| 534 | db_prepare(&q, |
| 535 | "SELECT pathname, %Q || pathname, deleted FROM vfile" |
| 536 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -221,15 +221,14 @@ | |
| 221 | ** |
| 222 | ** When adding files or directories recursively, filenames that begin |
| 223 | ** with "." are excluded by default. To include such files, add |
| 224 | ** the "--dotfiles" option to the command-line. |
| 225 | ** |
| 226 | ** The --ignore option is a comma-separate lists of glob patterns |
| 227 | ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore |
| 228 | ** option does not appear on the command line then the "ignore-glob" setting |
| 229 | ** is used. |
| 230 | ** |
| 231 | ** The --case-sensitive option determines whether or not filenames should |
| 232 | ** be treated case sensitive or not. If the option is not given, the default |
| 233 | ** depends on the global setting, or the operating system default, if not set. |
| 234 | ** |
| @@ -237,32 +236,25 @@ | |
| 236 | ** |
| 237 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 238 | ** --dotfiles include files beginning with a dot (".") |
| 239 | ** --ignore <CSG> ignore files matching patterns from the |
| 240 | ** comma separated list of glob patterns. |
| 241 | ** |
| 242 | ** See also: addremove, rm |
| 243 | */ |
| 244 | void add_cmd(void){ |
| 245 | int i; /* Loop counter */ |
| 246 | int vid; /* Currently checked out version */ |
| 247 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 248 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 249 | Glob *pIgnore; /* Ignore everything matching the glob patterns */ |
| 250 | unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ |
| 251 | |
| 252 | zIgnoreFlag = find_option("ignore",0,1); |
| 253 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 254 | capture_case_sensitive_option(); |
| 255 | db_must_be_within_tree(); |
| 256 | if( zIgnoreFlag==0 ){ |
| 257 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 258 | } |
| 259 | vid = db_lget_int("checkout",0); |
| 260 | if( vid==0 ){ |
| @@ -269,11 +261,10 @@ | |
| 261 | fossil_panic("no checkout to add to"); |
| 262 | } |
| 263 | db_begin_transaction(); |
| 264 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 265 | filename_collation()); |
| 266 | pIgnore = glob_create(zIgnoreFlag); |
| 267 | nRoot = strlen(g.zLocalRoot); |
| 268 | |
| 269 | /* Load the names of all files that are to be added into sfile temp table */ |
| 270 | for(i=2; i<g.argc; i++){ |
| @@ -283,11 +274,11 @@ | |
| 274 | |
| 275 | file_canonical_name(g.argv[i], &fullName, 0); |
| 276 | zName = blob_str(&fullName); |
| 277 | isDir = file_wd_isdir(zName); |
| 278 | if( isDir==1 ){ |
| 279 | vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore); |
| 280 | }else if( isDir==0 ){ |
| 281 | fossil_warning("not found: %s", zName); |
| 282 | }else if( file_access(zName, R_OK) ){ |
| 283 | fossil_fatal("cannot open %s", zName); |
| 284 | }else{ |
| @@ -298,11 +289,10 @@ | |
| 289 | ); |
| 290 | } |
| 291 | blob_reset(&fullName); |
| 292 | } |
| 293 | glob_free(pIgnore); |
| 294 | |
| 295 | add_files_in_sfile(vid); |
| 296 | db_end_transaction(0); |
| 297 | } |
| 298 | |
| @@ -461,13 +451,12 @@ | |
| 451 | ** |
| 452 | ** Files and directories whose names begin with "." are ignored unless |
| 453 | ** the --dotfiles option is used. |
| 454 | ** |
| 455 | ** The --ignore option overrides the "ignore-glob" setting, as do the |
| 456 | ** --case-sensitive option with the "case-sensitive" setting. See the |
| 457 | ** documentation on the "settings" command for further information. |
| 458 | ** |
| 459 | ** The -n|--dry-run option shows what would happen without actually doing anything. |
| 460 | ** |
| 461 | ** This command can be used to track third party software. |
| 462 | ** |
| @@ -474,37 +463,31 @@ | |
| 463 | ** Options: |
| 464 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 465 | ** --dotfiles include files beginning with a dot (".") |
| 466 | ** --ignore <CSG> ignore files matching patterns from the |
| 467 | ** comma separated list of glob patterns. |
| 468 | ** -n|--dry-run If given, display instead of run actions |
| 469 | ** |
| 470 | ** See also: add, rm |
| 471 | */ |
| 472 | void addremove_cmd(void){ |
| 473 | Blob path; |
| 474 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 475 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 476 | int dryRunFlag = find_option("dry-run","n",0)!=0; |
| 477 | int n; |
| 478 | Stmt q; |
| 479 | int vid; |
| 480 | int nAdd = 0; |
| 481 | int nDelete = 0; |
| 482 | Glob *pIgnore; |
| 483 | |
| 484 | if( !dryRunFlag ){ |
| 485 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 486 | } |
| 487 | capture_case_sensitive_option(); |
| 488 | db_must_be_within_tree(); |
| 489 | if( zIgnoreFlag==0 ){ |
| 490 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 491 | } |
| 492 | vid = db_lget_int("checkout",0); |
| 493 | if( vid==0 ){ |
| @@ -521,15 +504,13 @@ | |
| 504 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 505 | filename_collation()); |
| 506 | n = strlen(g.zLocalRoot); |
| 507 | blob_init(&path, g.zLocalRoot, n-1); |
| 508 | /* now we read the complete file structure into a temp table */ |
| 509 | pIgnore = glob_create(zIgnoreFlag); |
| 510 | vfile_scan(&path, blob_size(&path), scanFlags, pIgnore); |
| 511 | glob_free(pIgnore); |
| 512 | nAdd = add_files_in_sfile(vid); |
| 513 | |
| 514 | /* step 2: search for missing files */ |
| 515 | db_prepare(&q, |
| 516 | "SELECT pathname, %Q || pathname, deleted FROM vfile" |
| 517 |
+52
-28
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -326,12 +326,11 @@ | ||
| 326 | 326 | */ |
| 327 | 327 | static void locate_unmanaged_files( |
| 328 | 328 | int argc, /* Number of command-line arguments to examine */ |
| 329 | 329 | char **argv, /* values of command-line arguments */ |
| 330 | 330 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 331 | - Glob *pIgnore1, /* Do not add files that match this GLOB */ | |
| 332 | - Glob *pIgnore2 /* Omit files matching this GLOB too */ | |
| 331 | + Glob *pIgnore /* Do not add files that match this GLOB */ | |
| 333 | 332 | ){ |
| 334 | 333 | Blob name; /* Name of a candidate file or directory */ |
| 335 | 334 | char *zName; /* Name of a candidate file or directory */ |
| 336 | 335 | int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */ |
| 337 | 336 | int i; /* Loop counter */ |
| @@ -340,19 +339,19 @@ | ||
| 340 | 339 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 341 | 340 | filename_collation()); |
| 342 | 341 | nRoot = (int)strlen(g.zLocalRoot); |
| 343 | 342 | if( argc==0 ){ |
| 344 | 343 | blob_init(&name, g.zLocalRoot, nRoot - 1); |
| 345 | - vfile_scan(&name, blob_size(&name), scanFlags, pIgnore1, pIgnore2); | |
| 344 | + vfile_scan(&name, blob_size(&name), scanFlags, pIgnore); | |
| 346 | 345 | blob_reset(&name); |
| 347 | 346 | }else{ |
| 348 | 347 | for(i=0; i<argc; i++){ |
| 349 | 348 | file_canonical_name(argv[i], &name, 0); |
| 350 | 349 | zName = blob_str(&name); |
| 351 | 350 | isDir = file_wd_isdir(zName); |
| 352 | 351 | if( isDir==1 ){ |
| 353 | - vfile_scan(&name, nRoot-1, scanFlags, pIgnore1, pIgnore2); | |
| 352 | + vfile_scan(&name, nRoot-1, scanFlags, pIgnore); | |
| 354 | 353 | }else if( isDir==0 ){ |
| 355 | 354 | fossil_warning("not found: %s", zName); |
| 356 | 355 | }else if( file_access(zName, R_OK) ){ |
| 357 | 356 | fossil_fatal("cannot open %s", zName); |
| 358 | 357 | }else{ |
| @@ -409,11 +408,11 @@ | ||
| 409 | 408 | cwdRelative = determine_cwd_relative_option(); |
| 410 | 409 | if( zIgnoreFlag==0 ){ |
| 411 | 410 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 412 | 411 | } |
| 413 | 412 | pIgnore = glob_create(zIgnoreFlag); |
| 414 | - locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, 0); | |
| 413 | + locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore); | |
| 415 | 414 | glob_free(pIgnore); |
| 416 | 415 | db_prepare(&q, |
| 417 | 416 | "SELECT x FROM sfile" |
| 418 | 417 | " WHERE x NOT IN (%s)" |
| 419 | 418 | " ORDER BY 1", |
| @@ -444,79 +443,100 @@ | ||
| 444 | 443 | ** |
| 445 | 444 | ** Delete all "extra" files in the source tree. "Extra" files are |
| 446 | 445 | ** files that are not officially part of the checkout. This operation |
| 447 | 446 | ** cannot be undone. If paths are specified, only the directories or |
| 448 | 447 | ** files specified will be considered for cleaning. |
| 448 | +** | |
| 449 | +** WARNING: Normally, only the files unknown to Fossil are removed; | |
| 450 | +** however, if the --extreme option is specified, all files that are | |
| 451 | +** not part of the current checkout will be removed as well, without | |
| 452 | +** regard for the files which are normally ignored. | |
| 449 | 453 | ** |
| 450 | 454 | ** You will be prompted before removing each eligible file unless the |
| 451 | -** --force flag is in use or it matches the --clean option. The | |
| 455 | +** --force flag is in use or it matches the --ignore option. The | |
| 452 | 456 | ** GLOBPATTERN specified by the "ignore-glob" setting is used if the |
| 453 | -** --ignore option is omitted, the same with "clean-glob" and --clean | |
| 454 | -** as well as "keep-glob" and --keep. If you are sure you wish to | |
| 455 | -** remove all "extra" files except the ones specified with --ignore | |
| 456 | -** and --keep, you can specify the optional -f|--force flag and no | |
| 457 | -** prompts will be issued. If a file matches both --keep and --clean, | |
| 458 | -** --keep takes precedence. | |
| 457 | +** --ignore option is omitted, the same with "keep-glob" and --keep. | |
| 458 | +** If you are sure you wish to remove all "extra" files except the | |
| 459 | +** ones specified with --ignore and --keep, you can specify the | |
| 460 | +** optional -f|--force flag and no prompts will be issued. If a | |
| 461 | +** file matches both --keep and --ignore, --keep takes precedence. | |
| 459 | 462 | ** |
| 460 | 463 | ** Files and subdirectories whose names begin with "." are |
| 461 | 464 | ** normally kept. They are handled if the "--dotfiles" option |
| 462 | 465 | ** is used. |
| 463 | 466 | ** |
| 464 | 467 | ** Options: |
| 465 | 468 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 466 | 469 | ** --dotfiles Include files beginning with a dot ("."). |
| 467 | 470 | ** -f|--force Remove files without prompting. |
| 468 | -** --clean <CSG> Never prompt for files matching this | |
| 469 | -** comma separated list of glob patterns. | |
| 470 | 471 | ** --ignore <CSG> Ignore files matching patterns from the |
| 471 | 472 | ** comma separated list of glob patterns. |
| 472 | 473 | ** --keep <CSG> Keep files matching this comma separated |
| 473 | 474 | ** list of glob patterns. |
| 474 | 475 | ** -n|--dry-run If given, display instead of run actions. |
| 475 | 476 | ** --temp Remove only Fossil-generated temporary files. |
| 476 | 477 | ** -v|--verbose Show all files as they are removed. |
| 478 | +** -x|--extreme Remove all files not part of the current | |
| 479 | +** checkout, without taking into consideration | |
| 480 | +** the "ignore-glob" setting and the --ignore | |
| 481 | +** command line option. | |
| 482 | +** Compatibile with "git clean -x". | |
| 477 | 483 | ** |
| 478 | 484 | ** See also: addremove, extra, status |
| 479 | 485 | */ |
| 480 | 486 | void clean_cmd(void){ |
| 481 | - int allFlag, dryRunFlag, verboseFlag; | |
| 487 | + int allFlag, dryRunFlag, verboseFlag, extremeFlag; | |
| 482 | 488 | unsigned scanFlags = 0; |
| 483 | - const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; | |
| 489 | + const char *zIgnoreFlag, *zKeepFlag; | |
| 484 | 490 | Blob repo; |
| 485 | 491 | Stmt q; |
| 486 | - Glob *pIgnore, *pKeep, *pClean; | |
| 492 | + Glob *pIgnore, *pKeep; | |
| 487 | 493 | int nRoot; |
| 488 | 494 | |
| 489 | 495 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 490 | 496 | if( !dryRunFlag ){ |
| 491 | 497 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 492 | 498 | } |
| 499 | + extremeFlag = find_option("extreme","x",0)!=0; | |
| 493 | 500 | allFlag = find_option("force","f",0)!=0; |
| 494 | 501 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 495 | 502 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 496 | 503 | zIgnoreFlag = find_option("ignore",0,1); |
| 497 | 504 | verboseFlag = find_option("verbose","v",0)!=0; |
| 498 | 505 | zKeepFlag = find_option("keep",0,1); |
| 499 | - zCleanFlag = find_option("clean",0,1); | |
| 500 | 506 | capture_case_sensitive_option(); |
| 501 | 507 | db_must_be_within_tree(); |
| 502 | 508 | if( zIgnoreFlag==0 ){ |
| 503 | 509 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 504 | 510 | } |
| 505 | 511 | if( zKeepFlag==0 ){ |
| 506 | 512 | zKeepFlag = db_get("keep-glob", 0); |
| 507 | 513 | } |
| 508 | - if( zCleanFlag==0 ){ | |
| 509 | - zCleanFlag = db_get("clean-glob", 0); | |
| 510 | - } | |
| 511 | 514 | verify_all_options(); |
| 515 | + if( extremeFlag && !dryRunFlag && db_get_boolean("allow-clean-x", 0)==0){ | |
| 516 | + Blob extremeAnswer; | |
| 517 | + char *extremePrompt = | |
| 518 | + "\n\nWARNING: The --extreme option is enabled and all untracked files\n" | |
| 519 | + "that would otherwise be left alone will be deleted (i.e. those\n" | |
| 520 | + "matching the \"ignore-glob\" settings and the --ignore command\n" | |
| 521 | + "line option). As a precaution, in order to proceed with this\n" | |
| 522 | + "clean operation, the string \"YES\" must be entered in all upper\n" | |
| 523 | + "case; any other response will cancel the clean operation.\n\n" | |
| 524 | + "Do you still wish to proceed with the clean operation? "; | |
| 525 | + blob_zero(&extremeAnswer); | |
| 526 | + prompt_user(extremePrompt, &extremeAnswer); | |
| 527 | + if( fossil_strcmp(blob_str(&extremeAnswer), "YES")!=0 ){ | |
| 528 | + fossil_print("Extreme clean operation canceled.\n"); | |
| 529 | + blob_reset(&extremeAnswer); | |
| 530 | + return; | |
| 531 | + } | |
| 532 | + blob_reset(&extremeAnswer); | |
| 533 | + } | |
| 534 | + nRoot = (int)strlen(g.zLocalRoot); | |
| 512 | 535 | pIgnore = glob_create(zIgnoreFlag); |
| 513 | 536 | pKeep = glob_create(zKeepFlag); |
| 514 | - pClean = glob_create(zCleanFlag); | |
| 515 | - locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, pKeep); | |
| 516 | - glob_free(pKeep); | |
| 517 | - glob_free(pIgnore); | |
| 537 | + locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore); | |
| 518 | 538 | db_prepare(&q, |
| 519 | 539 | "SELECT %Q || x FROM sfile" |
| 520 | 540 | " WHERE x NOT IN (%s)" |
| 521 | 541 | " ORDER BY 1", |
| 522 | 542 | g.zLocalRoot, fossil_all_reserved_names(0) |
| @@ -523,14 +543,17 @@ | ||
| 523 | 543 | ); |
| 524 | 544 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 525 | 545 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 526 | 546 | } |
| 527 | 547 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 528 | - nRoot = (int)strlen(g.zLocalRoot); | |
| 529 | 548 | while( db_step(&q)==SQLITE_ROW ){ |
| 530 | 549 | const char *zName = db_column_text(&q, 0); |
| 531 | - if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ | |
| 550 | + if( glob_match(pKeep, zName+nRoot) ){ | |
| 551 | + fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot); | |
| 552 | + continue; | |
| 553 | + } | |
| 554 | + if( !allFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){ | |
| 532 | 555 | Blob ans; |
| 533 | 556 | char cReply; |
| 534 | 557 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 535 | 558 | zName+nRoot); |
| 536 | 559 | blob_zero(&ans); |
| @@ -549,11 +572,12 @@ | ||
| 549 | 572 | } |
| 550 | 573 | if( !dryRunFlag ){ |
| 551 | 574 | file_delete(zName); |
| 552 | 575 | } |
| 553 | 576 | } |
| 554 | - glob_free(pClean); | |
| 577 | + glob_free(pKeep); | |
| 578 | + glob_free(pIgnore); | |
| 555 | 579 | db_finalize(&q); |
| 556 | 580 | } |
| 557 | 581 | |
| 558 | 582 | /* |
| 559 | 583 | ** Prompt the user for a check-in or stash comment (given in pPrompt), |
| 560 | 584 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -326,12 +326,11 @@ | |
| 326 | */ |
| 327 | static void locate_unmanaged_files( |
| 328 | int argc, /* Number of command-line arguments to examine */ |
| 329 | char **argv, /* values of command-line arguments */ |
| 330 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 331 | Glob *pIgnore1, /* Do not add files that match this GLOB */ |
| 332 | Glob *pIgnore2 /* Omit files matching this GLOB too */ |
| 333 | ){ |
| 334 | Blob name; /* Name of a candidate file or directory */ |
| 335 | char *zName; /* Name of a candidate file or directory */ |
| 336 | int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */ |
| 337 | int i; /* Loop counter */ |
| @@ -340,19 +339,19 @@ | |
| 340 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 341 | filename_collation()); |
| 342 | nRoot = (int)strlen(g.zLocalRoot); |
| 343 | if( argc==0 ){ |
| 344 | blob_init(&name, g.zLocalRoot, nRoot - 1); |
| 345 | vfile_scan(&name, blob_size(&name), scanFlags, pIgnore1, pIgnore2); |
| 346 | blob_reset(&name); |
| 347 | }else{ |
| 348 | for(i=0; i<argc; i++){ |
| 349 | file_canonical_name(argv[i], &name, 0); |
| 350 | zName = blob_str(&name); |
| 351 | isDir = file_wd_isdir(zName); |
| 352 | if( isDir==1 ){ |
| 353 | vfile_scan(&name, nRoot-1, scanFlags, pIgnore1, pIgnore2); |
| 354 | }else if( isDir==0 ){ |
| 355 | fossil_warning("not found: %s", zName); |
| 356 | }else if( file_access(zName, R_OK) ){ |
| 357 | fossil_fatal("cannot open %s", zName); |
| 358 | }else{ |
| @@ -409,11 +408,11 @@ | |
| 409 | cwdRelative = determine_cwd_relative_option(); |
| 410 | if( zIgnoreFlag==0 ){ |
| 411 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 412 | } |
| 413 | pIgnore = glob_create(zIgnoreFlag); |
| 414 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, 0); |
| 415 | glob_free(pIgnore); |
| 416 | db_prepare(&q, |
| 417 | "SELECT x FROM sfile" |
| 418 | " WHERE x NOT IN (%s)" |
| 419 | " ORDER BY 1", |
| @@ -444,79 +443,100 @@ | |
| 444 | ** |
| 445 | ** Delete all "extra" files in the source tree. "Extra" files are |
| 446 | ** files that are not officially part of the checkout. This operation |
| 447 | ** cannot be undone. If paths are specified, only the directories or |
| 448 | ** files specified will be considered for cleaning. |
| 449 | ** |
| 450 | ** You will be prompted before removing each eligible file unless the |
| 451 | ** --force flag is in use or it matches the --clean option. The |
| 452 | ** GLOBPATTERN specified by the "ignore-glob" setting is used if the |
| 453 | ** --ignore option is omitted, the same with "clean-glob" and --clean |
| 454 | ** as well as "keep-glob" and --keep. If you are sure you wish to |
| 455 | ** remove all "extra" files except the ones specified with --ignore |
| 456 | ** and --keep, you can specify the optional -f|--force flag and no |
| 457 | ** prompts will be issued. If a file matches both --keep and --clean, |
| 458 | ** --keep takes precedence. |
| 459 | ** |
| 460 | ** Files and subdirectories whose names begin with "." are |
| 461 | ** normally kept. They are handled if the "--dotfiles" option |
| 462 | ** is used. |
| 463 | ** |
| 464 | ** Options: |
| 465 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 466 | ** --dotfiles Include files beginning with a dot ("."). |
| 467 | ** -f|--force Remove files without prompting. |
| 468 | ** --clean <CSG> Never prompt for files matching this |
| 469 | ** comma separated list of glob patterns. |
| 470 | ** --ignore <CSG> Ignore files matching patterns from the |
| 471 | ** comma separated list of glob patterns. |
| 472 | ** --keep <CSG> Keep files matching this comma separated |
| 473 | ** list of glob patterns. |
| 474 | ** -n|--dry-run If given, display instead of run actions. |
| 475 | ** --temp Remove only Fossil-generated temporary files. |
| 476 | ** -v|--verbose Show all files as they are removed. |
| 477 | ** |
| 478 | ** See also: addremove, extra, status |
| 479 | */ |
| 480 | void clean_cmd(void){ |
| 481 | int allFlag, dryRunFlag, verboseFlag; |
| 482 | unsigned scanFlags = 0; |
| 483 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 484 | Blob repo; |
| 485 | Stmt q; |
| 486 | Glob *pIgnore, *pKeep, *pClean; |
| 487 | int nRoot; |
| 488 | |
| 489 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 490 | if( !dryRunFlag ){ |
| 491 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 492 | } |
| 493 | allFlag = find_option("force","f",0)!=0; |
| 494 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 495 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 496 | zIgnoreFlag = find_option("ignore",0,1); |
| 497 | verboseFlag = find_option("verbose","v",0)!=0; |
| 498 | zKeepFlag = find_option("keep",0,1); |
| 499 | zCleanFlag = find_option("clean",0,1); |
| 500 | capture_case_sensitive_option(); |
| 501 | db_must_be_within_tree(); |
| 502 | if( zIgnoreFlag==0 ){ |
| 503 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 504 | } |
| 505 | if( zKeepFlag==0 ){ |
| 506 | zKeepFlag = db_get("keep-glob", 0); |
| 507 | } |
| 508 | if( zCleanFlag==0 ){ |
| 509 | zCleanFlag = db_get("clean-glob", 0); |
| 510 | } |
| 511 | verify_all_options(); |
| 512 | pIgnore = glob_create(zIgnoreFlag); |
| 513 | pKeep = glob_create(zKeepFlag); |
| 514 | pClean = glob_create(zCleanFlag); |
| 515 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, pKeep); |
| 516 | glob_free(pKeep); |
| 517 | glob_free(pIgnore); |
| 518 | db_prepare(&q, |
| 519 | "SELECT %Q || x FROM sfile" |
| 520 | " WHERE x NOT IN (%s)" |
| 521 | " ORDER BY 1", |
| 522 | g.zLocalRoot, fossil_all_reserved_names(0) |
| @@ -523,14 +543,17 @@ | |
| 523 | ); |
| 524 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 525 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 526 | } |
| 527 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 528 | nRoot = (int)strlen(g.zLocalRoot); |
| 529 | while( db_step(&q)==SQLITE_ROW ){ |
| 530 | const char *zName = db_column_text(&q, 0); |
| 531 | if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 532 | Blob ans; |
| 533 | char cReply; |
| 534 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 535 | zName+nRoot); |
| 536 | blob_zero(&ans); |
| @@ -549,11 +572,12 @@ | |
| 549 | } |
| 550 | if( !dryRunFlag ){ |
| 551 | file_delete(zName); |
| 552 | } |
| 553 | } |
| 554 | glob_free(pClean); |
| 555 | db_finalize(&q); |
| 556 | } |
| 557 | |
| 558 | /* |
| 559 | ** Prompt the user for a check-in or stash comment (given in pPrompt), |
| 560 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -326,12 +326,11 @@ | |
| 326 | */ |
| 327 | static void locate_unmanaged_files( |
| 328 | int argc, /* Number of command-line arguments to examine */ |
| 329 | char **argv, /* values of command-line arguments */ |
| 330 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 331 | Glob *pIgnore /* Do not add files that match this GLOB */ |
| 332 | ){ |
| 333 | Blob name; /* Name of a candidate file or directory */ |
| 334 | char *zName; /* Name of a candidate file or directory */ |
| 335 | int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */ |
| 336 | int i; /* Loop counter */ |
| @@ -340,19 +339,19 @@ | |
| 339 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 340 | filename_collation()); |
| 341 | nRoot = (int)strlen(g.zLocalRoot); |
| 342 | if( argc==0 ){ |
| 343 | blob_init(&name, g.zLocalRoot, nRoot - 1); |
| 344 | vfile_scan(&name, blob_size(&name), scanFlags, pIgnore); |
| 345 | blob_reset(&name); |
| 346 | }else{ |
| 347 | for(i=0; i<argc; i++){ |
| 348 | file_canonical_name(argv[i], &name, 0); |
| 349 | zName = blob_str(&name); |
| 350 | isDir = file_wd_isdir(zName); |
| 351 | if( isDir==1 ){ |
| 352 | vfile_scan(&name, nRoot-1, scanFlags, pIgnore); |
| 353 | }else if( isDir==0 ){ |
| 354 | fossil_warning("not found: %s", zName); |
| 355 | }else if( file_access(zName, R_OK) ){ |
| 356 | fossil_fatal("cannot open %s", zName); |
| 357 | }else{ |
| @@ -409,11 +408,11 @@ | |
| 408 | cwdRelative = determine_cwd_relative_option(); |
| 409 | if( zIgnoreFlag==0 ){ |
| 410 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 411 | } |
| 412 | pIgnore = glob_create(zIgnoreFlag); |
| 413 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore); |
| 414 | glob_free(pIgnore); |
| 415 | db_prepare(&q, |
| 416 | "SELECT x FROM sfile" |
| 417 | " WHERE x NOT IN (%s)" |
| 418 | " ORDER BY 1", |
| @@ -444,79 +443,100 @@ | |
| 443 | ** |
| 444 | ** Delete all "extra" files in the source tree. "Extra" files are |
| 445 | ** files that are not officially part of the checkout. This operation |
| 446 | ** cannot be undone. If paths are specified, only the directories or |
| 447 | ** files specified will be considered for cleaning. |
| 448 | ** |
| 449 | ** WARNING: Normally, only the files unknown to Fossil are removed; |
| 450 | ** however, if the --extreme option is specified, all files that are |
| 451 | ** not part of the current checkout will be removed as well, without |
| 452 | ** regard for the files which are normally ignored. |
| 453 | ** |
| 454 | ** You will be prompted before removing each eligible file unless the |
| 455 | ** --force flag is in use or it matches the --ignore option. The |
| 456 | ** GLOBPATTERN specified by the "ignore-glob" setting is used if the |
| 457 | ** --ignore option is omitted, the same with "keep-glob" and --keep. |
| 458 | ** If you are sure you wish to remove all "extra" files except the |
| 459 | ** ones specified with --ignore and --keep, you can specify the |
| 460 | ** optional -f|--force flag and no prompts will be issued. If a |
| 461 | ** file matches both --keep and --ignore, --keep takes precedence. |
| 462 | ** |
| 463 | ** Files and subdirectories whose names begin with "." are |
| 464 | ** normally kept. They are handled if the "--dotfiles" option |
| 465 | ** is used. |
| 466 | ** |
| 467 | ** Options: |
| 468 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 469 | ** --dotfiles Include files beginning with a dot ("."). |
| 470 | ** -f|--force Remove files without prompting. |
| 471 | ** --ignore <CSG> Ignore files matching patterns from the |
| 472 | ** comma separated list of glob patterns. |
| 473 | ** --keep <CSG> Keep files matching this comma separated |
| 474 | ** list of glob patterns. |
| 475 | ** -n|--dry-run If given, display instead of run actions. |
| 476 | ** --temp Remove only Fossil-generated temporary files. |
| 477 | ** -v|--verbose Show all files as they are removed. |
| 478 | ** -x|--extreme Remove all files not part of the current |
| 479 | ** checkout, without taking into consideration |
| 480 | ** the "ignore-glob" setting and the --ignore |
| 481 | ** command line option. |
| 482 | ** Compatibile with "git clean -x". |
| 483 | ** |
| 484 | ** See also: addremove, extra, status |
| 485 | */ |
| 486 | void clean_cmd(void){ |
| 487 | int allFlag, dryRunFlag, verboseFlag, extremeFlag; |
| 488 | unsigned scanFlags = 0; |
| 489 | const char *zIgnoreFlag, *zKeepFlag; |
| 490 | Blob repo; |
| 491 | Stmt q; |
| 492 | Glob *pIgnore, *pKeep; |
| 493 | int nRoot; |
| 494 | |
| 495 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 496 | if( !dryRunFlag ){ |
| 497 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 498 | } |
| 499 | extremeFlag = find_option("extreme","x",0)!=0; |
| 500 | allFlag = find_option("force","f",0)!=0; |
| 501 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 502 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 503 | zIgnoreFlag = find_option("ignore",0,1); |
| 504 | verboseFlag = find_option("verbose","v",0)!=0; |
| 505 | zKeepFlag = find_option("keep",0,1); |
| 506 | capture_case_sensitive_option(); |
| 507 | db_must_be_within_tree(); |
| 508 | if( zIgnoreFlag==0 ){ |
| 509 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 510 | } |
| 511 | if( zKeepFlag==0 ){ |
| 512 | zKeepFlag = db_get("keep-glob", 0); |
| 513 | } |
| 514 | verify_all_options(); |
| 515 | if( extremeFlag && !dryRunFlag && db_get_boolean("allow-clean-x", 0)==0){ |
| 516 | Blob extremeAnswer; |
| 517 | char *extremePrompt = |
| 518 | "\n\nWARNING: The --extreme option is enabled and all untracked files\n" |
| 519 | "that would otherwise be left alone will be deleted (i.e. those\n" |
| 520 | "matching the \"ignore-glob\" settings and the --ignore command\n" |
| 521 | "line option). As a precaution, in order to proceed with this\n" |
| 522 | "clean operation, the string \"YES\" must be entered in all upper\n" |
| 523 | "case; any other response will cancel the clean operation.\n\n" |
| 524 | "Do you still wish to proceed with the clean operation? "; |
| 525 | blob_zero(&extremeAnswer); |
| 526 | prompt_user(extremePrompt, &extremeAnswer); |
| 527 | if( fossil_strcmp(blob_str(&extremeAnswer), "YES")!=0 ){ |
| 528 | fossil_print("Extreme clean operation canceled.\n"); |
| 529 | blob_reset(&extremeAnswer); |
| 530 | return; |
| 531 | } |
| 532 | blob_reset(&extremeAnswer); |
| 533 | } |
| 534 | nRoot = (int)strlen(g.zLocalRoot); |
| 535 | pIgnore = glob_create(zIgnoreFlag); |
| 536 | pKeep = glob_create(zKeepFlag); |
| 537 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore); |
| 538 | db_prepare(&q, |
| 539 | "SELECT %Q || x FROM sfile" |
| 540 | " WHERE x NOT IN (%s)" |
| 541 | " ORDER BY 1", |
| 542 | g.zLocalRoot, fossil_all_reserved_names(0) |
| @@ -523,14 +543,17 @@ | |
| 543 | ); |
| 544 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 545 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 546 | } |
| 547 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 548 | while( db_step(&q)==SQLITE_ROW ){ |
| 549 | const char *zName = db_column_text(&q, 0); |
| 550 | if( glob_match(pKeep, zName+nRoot) ){ |
| 551 | fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot); |
| 552 | continue; |
| 553 | } |
| 554 | if( !allFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){ |
| 555 | Blob ans; |
| 556 | char cReply; |
| 557 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 558 | zName+nRoot); |
| 559 | blob_zero(&ans); |
| @@ -549,11 +572,12 @@ | |
| 572 | } |
| 573 | if( !dryRunFlag ){ |
| 574 | file_delete(zName); |
| 575 | } |
| 576 | } |
| 577 | glob_free(pKeep); |
| 578 | glob_free(pIgnore); |
| 579 | db_finalize(&q); |
| 580 | } |
| 581 | |
| 582 | /* |
| 583 | ** Prompt the user for a check-in or stash comment (given in pPrompt), |
| 584 |
+52
-28
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -326,12 +326,11 @@ | ||
| 326 | 326 | */ |
| 327 | 327 | static void locate_unmanaged_files( |
| 328 | 328 | int argc, /* Number of command-line arguments to examine */ |
| 329 | 329 | char **argv, /* values of command-line arguments */ |
| 330 | 330 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 331 | - Glob *pIgnore1, /* Do not add files that match this GLOB */ | |
| 332 | - Glob *pIgnore2 /* Omit files matching this GLOB too */ | |
| 331 | + Glob *pIgnore /* Do not add files that match this GLOB */ | |
| 333 | 332 | ){ |
| 334 | 333 | Blob name; /* Name of a candidate file or directory */ |
| 335 | 334 | char *zName; /* Name of a candidate file or directory */ |
| 336 | 335 | int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */ |
| 337 | 336 | int i; /* Loop counter */ |
| @@ -340,19 +339,19 @@ | ||
| 340 | 339 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 341 | 340 | filename_collation()); |
| 342 | 341 | nRoot = (int)strlen(g.zLocalRoot); |
| 343 | 342 | if( argc==0 ){ |
| 344 | 343 | blob_init(&name, g.zLocalRoot, nRoot - 1); |
| 345 | - vfile_scan(&name, blob_size(&name), scanFlags, pIgnore1, pIgnore2); | |
| 344 | + vfile_scan(&name, blob_size(&name), scanFlags, pIgnore); | |
| 346 | 345 | blob_reset(&name); |
| 347 | 346 | }else{ |
| 348 | 347 | for(i=0; i<argc; i++){ |
| 349 | 348 | file_canonical_name(argv[i], &name, 0); |
| 350 | 349 | zName = blob_str(&name); |
| 351 | 350 | isDir = file_wd_isdir(zName); |
| 352 | 351 | if( isDir==1 ){ |
| 353 | - vfile_scan(&name, nRoot-1, scanFlags, pIgnore1, pIgnore2); | |
| 352 | + vfile_scan(&name, nRoot-1, scanFlags, pIgnore); | |
| 354 | 353 | }else if( isDir==0 ){ |
| 355 | 354 | fossil_warning("not found: %s", zName); |
| 356 | 355 | }else if( file_access(zName, R_OK) ){ |
| 357 | 356 | fossil_fatal("cannot open %s", zName); |
| 358 | 357 | }else{ |
| @@ -409,11 +408,11 @@ | ||
| 409 | 408 | cwdRelative = determine_cwd_relative_option(); |
| 410 | 409 | if( zIgnoreFlag==0 ){ |
| 411 | 410 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 412 | 411 | } |
| 413 | 412 | pIgnore = glob_create(zIgnoreFlag); |
| 414 | - locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, 0); | |
| 413 | + locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore); | |
| 415 | 414 | glob_free(pIgnore); |
| 416 | 415 | db_prepare(&q, |
| 417 | 416 | "SELECT x FROM sfile" |
| 418 | 417 | " WHERE x NOT IN (%s)" |
| 419 | 418 | " ORDER BY 1", |
| @@ -444,79 +443,100 @@ | ||
| 444 | 443 | ** |
| 445 | 444 | ** Delete all "extra" files in the source tree. "Extra" files are |
| 446 | 445 | ** files that are not officially part of the checkout. This operation |
| 447 | 446 | ** cannot be undone. If paths are specified, only the directories or |
| 448 | 447 | ** files specified will be considered for cleaning. |
| 448 | +** | |
| 449 | +** WARNING: Normally, only the files unknown to Fossil are removed; | |
| 450 | +** however, if the --extreme option is specified, all files that are | |
| 451 | +** not part of the current checkout will be removed as well, without | |
| 452 | +** regard for the files which are normally ignored. | |
| 449 | 453 | ** |
| 450 | 454 | ** You will be prompted before removing each eligible file unless the |
| 451 | -** --force flag is in use or it matches the --clean option. The | |
| 455 | +** --force flag is in use or it matches the --ignore option. The | |
| 452 | 456 | ** GLOBPATTERN specified by the "ignore-glob" setting is used if the |
| 453 | -** --ignore option is omitted, the same with "clean-glob" and --clean | |
| 454 | -** as well as "keep-glob" and --keep. If you are sure you wish to | |
| 455 | -** remove all "extra" files except the ones specified with --ignore | |
| 456 | -** and --keep, you can specify the optional -f|--force flag and no | |
| 457 | -** prompts will be issued. If a file matches both --keep and --clean, | |
| 458 | -** --keep takes precedence. | |
| 457 | +** --ignore option is omitted, the same with "keep-glob" and --keep. | |
| 458 | +** If you are sure you wish to remove all "extra" files except the | |
| 459 | +** ones specified with --ignore and --keep, you can specify the | |
| 460 | +** optional -f|--force flag and no prompts will be issued. If a | |
| 461 | +** file matches both --keep and --ignore, --keep takes precedence. | |
| 459 | 462 | ** |
| 460 | 463 | ** Files and subdirectories whose names begin with "." are |
| 461 | 464 | ** normally kept. They are handled if the "--dotfiles" option |
| 462 | 465 | ** is used. |
| 463 | 466 | ** |
| 464 | 467 | ** Options: |
| 465 | 468 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 466 | 469 | ** --dotfiles Include files beginning with a dot ("."). |
| 467 | 470 | ** -f|--force Remove files without prompting. |
| 468 | -** --clean <CSG> Never prompt for files matching this | |
| 469 | -** comma separated list of glob patterns. | |
| 470 | 471 | ** --ignore <CSG> Ignore files matching patterns from the |
| 471 | 472 | ** comma separated list of glob patterns. |
| 472 | 473 | ** --keep <CSG> Keep files matching this comma separated |
| 473 | 474 | ** list of glob patterns. |
| 474 | 475 | ** -n|--dry-run If given, display instead of run actions. |
| 475 | 476 | ** --temp Remove only Fossil-generated temporary files. |
| 476 | 477 | ** -v|--verbose Show all files as they are removed. |
| 478 | +** -x|--extreme Remove all files not part of the current | |
| 479 | +** checkout, without taking into consideration | |
| 480 | +** the "ignore-glob" setting and the --ignore | |
| 481 | +** command line option. | |
| 482 | +** Compatibile with "git clean -x". | |
| 477 | 483 | ** |
| 478 | 484 | ** See also: addremove, extra, status |
| 479 | 485 | */ |
| 480 | 486 | void clean_cmd(void){ |
| 481 | - int allFlag, dryRunFlag, verboseFlag; | |
| 487 | + int allFlag, dryRunFlag, verboseFlag, extremeFlag; | |
| 482 | 488 | unsigned scanFlags = 0; |
| 483 | - const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; | |
| 489 | + const char *zIgnoreFlag, *zKeepFlag; | |
| 484 | 490 | Blob repo; |
| 485 | 491 | Stmt q; |
| 486 | - Glob *pIgnore, *pKeep, *pClean; | |
| 492 | + Glob *pIgnore, *pKeep; | |
| 487 | 493 | int nRoot; |
| 488 | 494 | |
| 489 | 495 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 490 | 496 | if( !dryRunFlag ){ |
| 491 | 497 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 492 | 498 | } |
| 499 | + extremeFlag = find_option("extreme","x",0)!=0; | |
| 493 | 500 | allFlag = find_option("force","f",0)!=0; |
| 494 | 501 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 495 | 502 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 496 | 503 | zIgnoreFlag = find_option("ignore",0,1); |
| 497 | 504 | verboseFlag = find_option("verbose","v",0)!=0; |
| 498 | 505 | zKeepFlag = find_option("keep",0,1); |
| 499 | - zCleanFlag = find_option("clean",0,1); | |
| 500 | 506 | capture_case_sensitive_option(); |
| 501 | 507 | db_must_be_within_tree(); |
| 502 | 508 | if( zIgnoreFlag==0 ){ |
| 503 | 509 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 504 | 510 | } |
| 505 | 511 | if( zKeepFlag==0 ){ |
| 506 | 512 | zKeepFlag = db_get("keep-glob", 0); |
| 507 | 513 | } |
| 508 | - if( zCleanFlag==0 ){ | |
| 509 | - zCleanFlag = db_get("clean-glob", 0); | |
| 510 | - } | |
| 511 | 514 | verify_all_options(); |
| 515 | + if( extremeFlag && !dryRunFlag && db_get_boolean("allow-clean-x", 0)==0){ | |
| 516 | + Blob extremeAnswer; | |
| 517 | + char *extremePrompt = | |
| 518 | + "\n\nWARNING: The --extreme option is enabled and all untracked files\n" | |
| 519 | + "that would otherwise be left alone will be deleted (i.e. those\n" | |
| 520 | + "matching the \"ignore-glob\" settings and the --ignore command\n" | |
| 521 | + "line option). As a precaution, in order to proceed with this\n" | |
| 522 | + "clean operation, the string \"YES\" must be entered in all upper\n" | |
| 523 | + "case; any other response will cancel the clean operation.\n\n" | |
| 524 | + "Do you still wish to proceed with the clean operation? "; | |
| 525 | + blob_zero(&extremeAnswer); | |
| 526 | + prompt_user(extremePrompt, &extremeAnswer); | |
| 527 | + if( fossil_strcmp(blob_str(&extremeAnswer), "YES")!=0 ){ | |
| 528 | + fossil_print("Extreme clean operation canceled.\n"); | |
| 529 | + blob_reset(&extremeAnswer); | |
| 530 | + return; | |
| 531 | + } | |
| 532 | + blob_reset(&extremeAnswer); | |
| 533 | + } | |
| 534 | + nRoot = (int)strlen(g.zLocalRoot); | |
| 512 | 535 | pIgnore = glob_create(zIgnoreFlag); |
| 513 | 536 | pKeep = glob_create(zKeepFlag); |
| 514 | - pClean = glob_create(zCleanFlag); | |
| 515 | - locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, pKeep); | |
| 516 | - glob_free(pKeep); | |
| 517 | - glob_free(pIgnore); | |
| 537 | + locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore); | |
| 518 | 538 | db_prepare(&q, |
| 519 | 539 | "SELECT %Q || x FROM sfile" |
| 520 | 540 | " WHERE x NOT IN (%s)" |
| 521 | 541 | " ORDER BY 1", |
| 522 | 542 | g.zLocalRoot, fossil_all_reserved_names(0) |
| @@ -523,14 +543,17 @@ | ||
| 523 | 543 | ); |
| 524 | 544 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 525 | 545 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 526 | 546 | } |
| 527 | 547 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 528 | - nRoot = (int)strlen(g.zLocalRoot); | |
| 529 | 548 | while( db_step(&q)==SQLITE_ROW ){ |
| 530 | 549 | const char *zName = db_column_text(&q, 0); |
| 531 | - if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ | |
| 550 | + if( glob_match(pKeep, zName+nRoot) ){ | |
| 551 | + fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot); | |
| 552 | + continue; | |
| 553 | + } | |
| 554 | + if( !allFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){ | |
| 532 | 555 | Blob ans; |
| 533 | 556 | char cReply; |
| 534 | 557 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 535 | 558 | zName+nRoot); |
| 536 | 559 | blob_zero(&ans); |
| @@ -549,11 +572,12 @@ | ||
| 549 | 572 | } |
| 550 | 573 | if( !dryRunFlag ){ |
| 551 | 574 | file_delete(zName); |
| 552 | 575 | } |
| 553 | 576 | } |
| 554 | - glob_free(pClean); | |
| 577 | + glob_free(pKeep); | |
| 578 | + glob_free(pIgnore); | |
| 555 | 579 | db_finalize(&q); |
| 556 | 580 | } |
| 557 | 581 | |
| 558 | 582 | /* |
| 559 | 583 | ** Prompt the user for a check-in or stash comment (given in pPrompt), |
| 560 | 584 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -326,12 +326,11 @@ | |
| 326 | */ |
| 327 | static void locate_unmanaged_files( |
| 328 | int argc, /* Number of command-line arguments to examine */ |
| 329 | char **argv, /* values of command-line arguments */ |
| 330 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 331 | Glob *pIgnore1, /* Do not add files that match this GLOB */ |
| 332 | Glob *pIgnore2 /* Omit files matching this GLOB too */ |
| 333 | ){ |
| 334 | Blob name; /* Name of a candidate file or directory */ |
| 335 | char *zName; /* Name of a candidate file or directory */ |
| 336 | int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */ |
| 337 | int i; /* Loop counter */ |
| @@ -340,19 +339,19 @@ | |
| 340 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 341 | filename_collation()); |
| 342 | nRoot = (int)strlen(g.zLocalRoot); |
| 343 | if( argc==0 ){ |
| 344 | blob_init(&name, g.zLocalRoot, nRoot - 1); |
| 345 | vfile_scan(&name, blob_size(&name), scanFlags, pIgnore1, pIgnore2); |
| 346 | blob_reset(&name); |
| 347 | }else{ |
| 348 | for(i=0; i<argc; i++){ |
| 349 | file_canonical_name(argv[i], &name, 0); |
| 350 | zName = blob_str(&name); |
| 351 | isDir = file_wd_isdir(zName); |
| 352 | if( isDir==1 ){ |
| 353 | vfile_scan(&name, nRoot-1, scanFlags, pIgnore1, pIgnore2); |
| 354 | }else if( isDir==0 ){ |
| 355 | fossil_warning("not found: %s", zName); |
| 356 | }else if( file_access(zName, R_OK) ){ |
| 357 | fossil_fatal("cannot open %s", zName); |
| 358 | }else{ |
| @@ -409,11 +408,11 @@ | |
| 409 | cwdRelative = determine_cwd_relative_option(); |
| 410 | if( zIgnoreFlag==0 ){ |
| 411 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 412 | } |
| 413 | pIgnore = glob_create(zIgnoreFlag); |
| 414 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, 0); |
| 415 | glob_free(pIgnore); |
| 416 | db_prepare(&q, |
| 417 | "SELECT x FROM sfile" |
| 418 | " WHERE x NOT IN (%s)" |
| 419 | " ORDER BY 1", |
| @@ -444,79 +443,100 @@ | |
| 444 | ** |
| 445 | ** Delete all "extra" files in the source tree. "Extra" files are |
| 446 | ** files that are not officially part of the checkout. This operation |
| 447 | ** cannot be undone. If paths are specified, only the directories or |
| 448 | ** files specified will be considered for cleaning. |
| 449 | ** |
| 450 | ** You will be prompted before removing each eligible file unless the |
| 451 | ** --force flag is in use or it matches the --clean option. The |
| 452 | ** GLOBPATTERN specified by the "ignore-glob" setting is used if the |
| 453 | ** --ignore option is omitted, the same with "clean-glob" and --clean |
| 454 | ** as well as "keep-glob" and --keep. If you are sure you wish to |
| 455 | ** remove all "extra" files except the ones specified with --ignore |
| 456 | ** and --keep, you can specify the optional -f|--force flag and no |
| 457 | ** prompts will be issued. If a file matches both --keep and --clean, |
| 458 | ** --keep takes precedence. |
| 459 | ** |
| 460 | ** Files and subdirectories whose names begin with "." are |
| 461 | ** normally kept. They are handled if the "--dotfiles" option |
| 462 | ** is used. |
| 463 | ** |
| 464 | ** Options: |
| 465 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 466 | ** --dotfiles Include files beginning with a dot ("."). |
| 467 | ** -f|--force Remove files without prompting. |
| 468 | ** --clean <CSG> Never prompt for files matching this |
| 469 | ** comma separated list of glob patterns. |
| 470 | ** --ignore <CSG> Ignore files matching patterns from the |
| 471 | ** comma separated list of glob patterns. |
| 472 | ** --keep <CSG> Keep files matching this comma separated |
| 473 | ** list of glob patterns. |
| 474 | ** -n|--dry-run If given, display instead of run actions. |
| 475 | ** --temp Remove only Fossil-generated temporary files. |
| 476 | ** -v|--verbose Show all files as they are removed. |
| 477 | ** |
| 478 | ** See also: addremove, extra, status |
| 479 | */ |
| 480 | void clean_cmd(void){ |
| 481 | int allFlag, dryRunFlag, verboseFlag; |
| 482 | unsigned scanFlags = 0; |
| 483 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 484 | Blob repo; |
| 485 | Stmt q; |
| 486 | Glob *pIgnore, *pKeep, *pClean; |
| 487 | int nRoot; |
| 488 | |
| 489 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 490 | if( !dryRunFlag ){ |
| 491 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 492 | } |
| 493 | allFlag = find_option("force","f",0)!=0; |
| 494 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 495 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 496 | zIgnoreFlag = find_option("ignore",0,1); |
| 497 | verboseFlag = find_option("verbose","v",0)!=0; |
| 498 | zKeepFlag = find_option("keep",0,1); |
| 499 | zCleanFlag = find_option("clean",0,1); |
| 500 | capture_case_sensitive_option(); |
| 501 | db_must_be_within_tree(); |
| 502 | if( zIgnoreFlag==0 ){ |
| 503 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 504 | } |
| 505 | if( zKeepFlag==0 ){ |
| 506 | zKeepFlag = db_get("keep-glob", 0); |
| 507 | } |
| 508 | if( zCleanFlag==0 ){ |
| 509 | zCleanFlag = db_get("clean-glob", 0); |
| 510 | } |
| 511 | verify_all_options(); |
| 512 | pIgnore = glob_create(zIgnoreFlag); |
| 513 | pKeep = glob_create(zKeepFlag); |
| 514 | pClean = glob_create(zCleanFlag); |
| 515 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, pKeep); |
| 516 | glob_free(pKeep); |
| 517 | glob_free(pIgnore); |
| 518 | db_prepare(&q, |
| 519 | "SELECT %Q || x FROM sfile" |
| 520 | " WHERE x NOT IN (%s)" |
| 521 | " ORDER BY 1", |
| 522 | g.zLocalRoot, fossil_all_reserved_names(0) |
| @@ -523,14 +543,17 @@ | |
| 523 | ); |
| 524 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 525 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 526 | } |
| 527 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 528 | nRoot = (int)strlen(g.zLocalRoot); |
| 529 | while( db_step(&q)==SQLITE_ROW ){ |
| 530 | const char *zName = db_column_text(&q, 0); |
| 531 | if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 532 | Blob ans; |
| 533 | char cReply; |
| 534 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 535 | zName+nRoot); |
| 536 | blob_zero(&ans); |
| @@ -549,11 +572,12 @@ | |
| 549 | } |
| 550 | if( !dryRunFlag ){ |
| 551 | file_delete(zName); |
| 552 | } |
| 553 | } |
| 554 | glob_free(pClean); |
| 555 | db_finalize(&q); |
| 556 | } |
| 557 | |
| 558 | /* |
| 559 | ** Prompt the user for a check-in or stash comment (given in pPrompt), |
| 560 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -326,12 +326,11 @@ | |
| 326 | */ |
| 327 | static void locate_unmanaged_files( |
| 328 | int argc, /* Number of command-line arguments to examine */ |
| 329 | char **argv, /* values of command-line arguments */ |
| 330 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 331 | Glob *pIgnore /* Do not add files that match this GLOB */ |
| 332 | ){ |
| 333 | Blob name; /* Name of a candidate file or directory */ |
| 334 | char *zName; /* Name of a candidate file or directory */ |
| 335 | int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */ |
| 336 | int i; /* Loop counter */ |
| @@ -340,19 +339,19 @@ | |
| 339 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 340 | filename_collation()); |
| 341 | nRoot = (int)strlen(g.zLocalRoot); |
| 342 | if( argc==0 ){ |
| 343 | blob_init(&name, g.zLocalRoot, nRoot - 1); |
| 344 | vfile_scan(&name, blob_size(&name), scanFlags, pIgnore); |
| 345 | blob_reset(&name); |
| 346 | }else{ |
| 347 | for(i=0; i<argc; i++){ |
| 348 | file_canonical_name(argv[i], &name, 0); |
| 349 | zName = blob_str(&name); |
| 350 | isDir = file_wd_isdir(zName); |
| 351 | if( isDir==1 ){ |
| 352 | vfile_scan(&name, nRoot-1, scanFlags, pIgnore); |
| 353 | }else if( isDir==0 ){ |
| 354 | fossil_warning("not found: %s", zName); |
| 355 | }else if( file_access(zName, R_OK) ){ |
| 356 | fossil_fatal("cannot open %s", zName); |
| 357 | }else{ |
| @@ -409,11 +408,11 @@ | |
| 408 | cwdRelative = determine_cwd_relative_option(); |
| 409 | if( zIgnoreFlag==0 ){ |
| 410 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 411 | } |
| 412 | pIgnore = glob_create(zIgnoreFlag); |
| 413 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore); |
| 414 | glob_free(pIgnore); |
| 415 | db_prepare(&q, |
| 416 | "SELECT x FROM sfile" |
| 417 | " WHERE x NOT IN (%s)" |
| 418 | " ORDER BY 1", |
| @@ -444,79 +443,100 @@ | |
| 443 | ** |
| 444 | ** Delete all "extra" files in the source tree. "Extra" files are |
| 445 | ** files that are not officially part of the checkout. This operation |
| 446 | ** cannot be undone. If paths are specified, only the directories or |
| 447 | ** files specified will be considered for cleaning. |
| 448 | ** |
| 449 | ** WARNING: Normally, only the files unknown to Fossil are removed; |
| 450 | ** however, if the --extreme option is specified, all files that are |
| 451 | ** not part of the current checkout will be removed as well, without |
| 452 | ** regard for the files which are normally ignored. |
| 453 | ** |
| 454 | ** You will be prompted before removing each eligible file unless the |
| 455 | ** --force flag is in use or it matches the --ignore option. The |
| 456 | ** GLOBPATTERN specified by the "ignore-glob" setting is used if the |
| 457 | ** --ignore option is omitted, the same with "keep-glob" and --keep. |
| 458 | ** If you are sure you wish to remove all "extra" files except the |
| 459 | ** ones specified with --ignore and --keep, you can specify the |
| 460 | ** optional -f|--force flag and no prompts will be issued. If a |
| 461 | ** file matches both --keep and --ignore, --keep takes precedence. |
| 462 | ** |
| 463 | ** Files and subdirectories whose names begin with "." are |
| 464 | ** normally kept. They are handled if the "--dotfiles" option |
| 465 | ** is used. |
| 466 | ** |
| 467 | ** Options: |
| 468 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 469 | ** --dotfiles Include files beginning with a dot ("."). |
| 470 | ** -f|--force Remove files without prompting. |
| 471 | ** --ignore <CSG> Ignore files matching patterns from the |
| 472 | ** comma separated list of glob patterns. |
| 473 | ** --keep <CSG> Keep files matching this comma separated |
| 474 | ** list of glob patterns. |
| 475 | ** -n|--dry-run If given, display instead of run actions. |
| 476 | ** --temp Remove only Fossil-generated temporary files. |
| 477 | ** -v|--verbose Show all files as they are removed. |
| 478 | ** -x|--extreme Remove all files not part of the current |
| 479 | ** checkout, without taking into consideration |
| 480 | ** the "ignore-glob" setting and the --ignore |
| 481 | ** command line option. |
| 482 | ** Compatibile with "git clean -x". |
| 483 | ** |
| 484 | ** See also: addremove, extra, status |
| 485 | */ |
| 486 | void clean_cmd(void){ |
| 487 | int allFlag, dryRunFlag, verboseFlag, extremeFlag; |
| 488 | unsigned scanFlags = 0; |
| 489 | const char *zIgnoreFlag, *zKeepFlag; |
| 490 | Blob repo; |
| 491 | Stmt q; |
| 492 | Glob *pIgnore, *pKeep; |
| 493 | int nRoot; |
| 494 | |
| 495 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 496 | if( !dryRunFlag ){ |
| 497 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 498 | } |
| 499 | extremeFlag = find_option("extreme","x",0)!=0; |
| 500 | allFlag = find_option("force","f",0)!=0; |
| 501 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 502 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 503 | zIgnoreFlag = find_option("ignore",0,1); |
| 504 | verboseFlag = find_option("verbose","v",0)!=0; |
| 505 | zKeepFlag = find_option("keep",0,1); |
| 506 | capture_case_sensitive_option(); |
| 507 | db_must_be_within_tree(); |
| 508 | if( zIgnoreFlag==0 ){ |
| 509 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 510 | } |
| 511 | if( zKeepFlag==0 ){ |
| 512 | zKeepFlag = db_get("keep-glob", 0); |
| 513 | } |
| 514 | verify_all_options(); |
| 515 | if( extremeFlag && !dryRunFlag && db_get_boolean("allow-clean-x", 0)==0){ |
| 516 | Blob extremeAnswer; |
| 517 | char *extremePrompt = |
| 518 | "\n\nWARNING: The --extreme option is enabled and all untracked files\n" |
| 519 | "that would otherwise be left alone will be deleted (i.e. those\n" |
| 520 | "matching the \"ignore-glob\" settings and the --ignore command\n" |
| 521 | "line option). As a precaution, in order to proceed with this\n" |
| 522 | "clean operation, the string \"YES\" must be entered in all upper\n" |
| 523 | "case; any other response will cancel the clean operation.\n\n" |
| 524 | "Do you still wish to proceed with the clean operation? "; |
| 525 | blob_zero(&extremeAnswer); |
| 526 | prompt_user(extremePrompt, &extremeAnswer); |
| 527 | if( fossil_strcmp(blob_str(&extremeAnswer), "YES")!=0 ){ |
| 528 | fossil_print("Extreme clean operation canceled.\n"); |
| 529 | blob_reset(&extremeAnswer); |
| 530 | return; |
| 531 | } |
| 532 | blob_reset(&extremeAnswer); |
| 533 | } |
| 534 | nRoot = (int)strlen(g.zLocalRoot); |
| 535 | pIgnore = glob_create(zIgnoreFlag); |
| 536 | pKeep = glob_create(zKeepFlag); |
| 537 | locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore); |
| 538 | db_prepare(&q, |
| 539 | "SELECT %Q || x FROM sfile" |
| 540 | " WHERE x NOT IN (%s)" |
| 541 | " ORDER BY 1", |
| 542 | g.zLocalRoot, fossil_all_reserved_names(0) |
| @@ -523,14 +543,17 @@ | |
| 543 | ); |
| 544 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 545 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 546 | } |
| 547 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 548 | while( db_step(&q)==SQLITE_ROW ){ |
| 549 | const char *zName = db_column_text(&q, 0); |
| 550 | if( glob_match(pKeep, zName+nRoot) ){ |
| 551 | fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot); |
| 552 | continue; |
| 553 | } |
| 554 | if( !allFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){ |
| 555 | Blob ans; |
| 556 | char cReply; |
| 557 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 558 | zName+nRoot); |
| 559 | blob_zero(&ans); |
| @@ -549,11 +572,12 @@ | |
| 572 | } |
| 573 | if( !dryRunFlag ){ |
| 574 | file_delete(zName); |
| 575 | } |
| 576 | } |
| 577 | glob_free(pKeep); |
| 578 | glob_free(pIgnore); |
| 579 | db_finalize(&q); |
| 580 | } |
| 581 | |
| 582 | /* |
| 583 | ** Prompt the user for a check-in or stash comment (given in pPrompt), |
| 584 |
-1
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -101,11 +101,10 @@ | ||
| 101 | 101 | |
| 102 | 102 | { "project-name", CONFIGSET_PROJ }, |
| 103 | 103 | { "project-description", CONFIGSET_PROJ }, |
| 104 | 104 | { "manifest", CONFIGSET_PROJ }, |
| 105 | 105 | { "binary-glob", CONFIGSET_PROJ }, |
| 106 | - { "clean-glob", CONFIGSET_PROJ }, | |
| 107 | 106 | { "ignore-glob", CONFIGSET_PROJ }, |
| 108 | 107 | { "keep-glob", CONFIGSET_PROJ }, |
| 109 | 108 | { "crnl-glob", CONFIGSET_PROJ }, |
| 110 | 109 | { "encoding-glob", CONFIGSET_PROJ }, |
| 111 | 110 | { "empty-dirs", CONFIGSET_PROJ }, |
| 112 | 111 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -101,11 +101,10 @@ | |
| 101 | |
| 102 | { "project-name", CONFIGSET_PROJ }, |
| 103 | { "project-description", CONFIGSET_PROJ }, |
| 104 | { "manifest", CONFIGSET_PROJ }, |
| 105 | { "binary-glob", CONFIGSET_PROJ }, |
| 106 | { "clean-glob", CONFIGSET_PROJ }, |
| 107 | { "ignore-glob", CONFIGSET_PROJ }, |
| 108 | { "keep-glob", CONFIGSET_PROJ }, |
| 109 | { "crnl-glob", CONFIGSET_PROJ }, |
| 110 | { "encoding-glob", CONFIGSET_PROJ }, |
| 111 | { "empty-dirs", CONFIGSET_PROJ }, |
| 112 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -101,11 +101,10 @@ | |
| 101 | |
| 102 | { "project-name", CONFIGSET_PROJ }, |
| 103 | { "project-description", CONFIGSET_PROJ }, |
| 104 | { "manifest", CONFIGSET_PROJ }, |
| 105 | { "binary-glob", CONFIGSET_PROJ }, |
| 106 | { "ignore-glob", CONFIGSET_PROJ }, |
| 107 | { "keep-glob", CONFIGSET_PROJ }, |
| 108 | { "crnl-glob", CONFIGSET_PROJ }, |
| 109 | { "encoding-glob", CONFIGSET_PROJ }, |
| 110 | { "empty-dirs", CONFIGSET_PROJ }, |
| 111 |
M
src/db.c
+7
-8
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2089,10 +2089,11 @@ | ||
| 2089 | 2089 | char const *def; /* Default value */ |
| 2090 | 2090 | }; |
| 2091 | 2091 | #endif /* INTERFACE */ |
| 2092 | 2092 | struct stControlSettings const ctrlSettings[] = { |
| 2093 | 2093 | { "access-log", 0, 0, 0, "off" }, |
| 2094 | + { "allow-clean-x", 0, 0, 0, "off" }, | |
| 2094 | 2095 | { "allow-symlinks",0, 0, 1, "off" }, |
| 2095 | 2096 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 2096 | 2097 | { "auto-hyperlink",0, 0, 0, "on", }, |
| 2097 | 2098 | { "auto-shun", 0, 0, 0, "on" }, |
| 2098 | 2099 | { "autosync", 0, 0, 0, "on" }, |
| @@ -2101,11 +2102,10 @@ | ||
| 2101 | 2102 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) |
| 2102 | 2103 | { "case-sensitive",0, 0, 0, "off" }, |
| 2103 | 2104 | #else |
| 2104 | 2105 | { "case-sensitive",0, 0, 0, "on" }, |
| 2105 | 2106 | #endif |
| 2106 | - { "clean-glob", 0, 40, 1, "" }, | |
| 2107 | 2107 | { "crnl-glob", 0, 40, 1, "" }, |
| 2108 | 2108 | { "default-perms", 0, 16, 0, "u" }, |
| 2109 | 2109 | { "diff-binary", 0, 0, 0, "on" }, |
| 2110 | 2110 | { "diff-command", 0, 40, 0, "" }, |
| 2111 | 2111 | { "dont-push", 0, 0, 0, "off" }, |
| @@ -2165,10 +2165,14 @@ | ||
| 2165 | 2165 | ** allow-symlinks If enabled, don't follow symlinks, and instead treat |
| 2166 | 2166 | ** (versionable) them as symlinks on Unix. Has no effect on Windows |
| 2167 | 2167 | ** (existing links in repository created on Unix become |
| 2168 | 2168 | ** plain-text files with link destination path inside). |
| 2169 | 2169 | ** Default: off |
| 2170 | +** | |
| 2171 | +** allow-clean-x If enabled, allow the --extreme option to be used in | |
| 2172 | +** the clean command. | |
| 2173 | +** Default: off | |
| 2170 | 2174 | ** |
| 2171 | 2175 | ** auto-captcha If enabled, the Login page provides a button to |
| 2172 | 2176 | ** fill in the captcha password. Default: on |
| 2173 | 2177 | ** |
| 2174 | 2178 | ** auto-hyperlink Use javascript to enable hyperlinks on web pages |
| @@ -2193,15 +2197,10 @@ | ||
| 2193 | 2197 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2194 | 2198 | ** care considered distinct. If FALSE files whose names |
| 2195 | 2199 | ** differ only in case are the same file. Defaults to |
| 2196 | 2200 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2197 | 2201 | ** |
| 2198 | -** clean-glob The VALUE is a comma or newline-separated list of GLOB | |
| 2199 | -** (versionable) patterns specifying files that the "clean" command will | |
| 2200 | -** delete without prompting even when the -force flag has | |
| 2201 | -** not been used. Example: *.a *.lib *.o | |
| 2202 | -** | |
| 2203 | 2202 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2204 | 2203 | ** with gpg. When disabled (the default), commits will |
| 2205 | 2204 | ** be unsigned. Default: off |
| 2206 | 2205 | ** |
| 2207 | 2206 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| @@ -2251,15 +2250,15 @@ | ||
| 2251 | 2250 | ** even if the login page request came via HTTP. |
| 2252 | 2251 | ** |
| 2253 | 2252 | ** ignore-glob The VALUE is a comma or newline-separated list of GLOB |
| 2254 | 2253 | ** (versionable) patterns specifying files that the "add", "addremove", |
| 2255 | 2254 | ** "clean", and "extra" commands will ignore. |
| 2256 | -** Example: *.log customCode.c notes.txt | |
| 2255 | +** Example: *.log *.a *.lib *.o | |
| 2257 | 2256 | ** |
| 2258 | 2257 | ** keep-glob The VALUE is a comma or newline-separated list of GLOB |
| 2259 | 2258 | ** (versionable) patterns specifying files that the "clean" command will |
| 2260 | -** keep. | |
| 2259 | +** keep. Example: *.log customCode.c notes.txt | |
| 2261 | 2260 | ** |
| 2262 | 2261 | ** localauth If enabled, require that HTTP connections from |
| 2263 | 2262 | ** 127.0.0.1 be authenticated by password. If |
| 2264 | 2263 | ** false, all HTTP requests from localhost have |
| 2265 | 2264 | ** unrestricted access to the repository. |
| 2266 | 2265 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2089,10 +2089,11 @@ | |
| 2089 | char const *def; /* Default value */ |
| 2090 | }; |
| 2091 | #endif /* INTERFACE */ |
| 2092 | struct stControlSettings const ctrlSettings[] = { |
| 2093 | { "access-log", 0, 0, 0, "off" }, |
| 2094 | { "allow-symlinks",0, 0, 1, "off" }, |
| 2095 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 2096 | { "auto-hyperlink",0, 0, 0, "on", }, |
| 2097 | { "auto-shun", 0, 0, 0, "on" }, |
| 2098 | { "autosync", 0, 0, 0, "on" }, |
| @@ -2101,11 +2102,10 @@ | |
| 2101 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) |
| 2102 | { "case-sensitive",0, 0, 0, "off" }, |
| 2103 | #else |
| 2104 | { "case-sensitive",0, 0, 0, "on" }, |
| 2105 | #endif |
| 2106 | { "clean-glob", 0, 40, 1, "" }, |
| 2107 | { "crnl-glob", 0, 40, 1, "" }, |
| 2108 | { "default-perms", 0, 16, 0, "u" }, |
| 2109 | { "diff-binary", 0, 0, 0, "on" }, |
| 2110 | { "diff-command", 0, 40, 0, "" }, |
| 2111 | { "dont-push", 0, 0, 0, "off" }, |
| @@ -2165,10 +2165,14 @@ | |
| 2165 | ** allow-symlinks If enabled, don't follow symlinks, and instead treat |
| 2166 | ** (versionable) them as symlinks on Unix. Has no effect on Windows |
| 2167 | ** (existing links in repository created on Unix become |
| 2168 | ** plain-text files with link destination path inside). |
| 2169 | ** Default: off |
| 2170 | ** |
| 2171 | ** auto-captcha If enabled, the Login page provides a button to |
| 2172 | ** fill in the captcha password. Default: on |
| 2173 | ** |
| 2174 | ** auto-hyperlink Use javascript to enable hyperlinks on web pages |
| @@ -2193,15 +2197,10 @@ | |
| 2193 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2194 | ** care considered distinct. If FALSE files whose names |
| 2195 | ** differ only in case are the same file. Defaults to |
| 2196 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2197 | ** |
| 2198 | ** clean-glob The VALUE is a comma or newline-separated list of GLOB |
| 2199 | ** (versionable) patterns specifying files that the "clean" command will |
| 2200 | ** delete without prompting even when the -force flag has |
| 2201 | ** not been used. Example: *.a *.lib *.o |
| 2202 | ** |
| 2203 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2204 | ** with gpg. When disabled (the default), commits will |
| 2205 | ** be unsigned. Default: off |
| 2206 | ** |
| 2207 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| @@ -2251,15 +2250,15 @@ | |
| 2251 | ** even if the login page request came via HTTP. |
| 2252 | ** |
| 2253 | ** ignore-glob The VALUE is a comma or newline-separated list of GLOB |
| 2254 | ** (versionable) patterns specifying files that the "add", "addremove", |
| 2255 | ** "clean", and "extra" commands will ignore. |
| 2256 | ** Example: *.log customCode.c notes.txt |
| 2257 | ** |
| 2258 | ** keep-glob The VALUE is a comma or newline-separated list of GLOB |
| 2259 | ** (versionable) patterns specifying files that the "clean" command will |
| 2260 | ** keep. |
| 2261 | ** |
| 2262 | ** localauth If enabled, require that HTTP connections from |
| 2263 | ** 127.0.0.1 be authenticated by password. If |
| 2264 | ** false, all HTTP requests from localhost have |
| 2265 | ** unrestricted access to the repository. |
| 2266 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2089,10 +2089,11 @@ | |
| 2089 | char const *def; /* Default value */ |
| 2090 | }; |
| 2091 | #endif /* INTERFACE */ |
| 2092 | struct stControlSettings const ctrlSettings[] = { |
| 2093 | { "access-log", 0, 0, 0, "off" }, |
| 2094 | { "allow-clean-x", 0, 0, 0, "off" }, |
| 2095 | { "allow-symlinks",0, 0, 1, "off" }, |
| 2096 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 2097 | { "auto-hyperlink",0, 0, 0, "on", }, |
| 2098 | { "auto-shun", 0, 0, 0, "on" }, |
| 2099 | { "autosync", 0, 0, 0, "on" }, |
| @@ -2101,11 +2102,10 @@ | |
| 2102 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) |
| 2103 | { "case-sensitive",0, 0, 0, "off" }, |
| 2104 | #else |
| 2105 | { "case-sensitive",0, 0, 0, "on" }, |
| 2106 | #endif |
| 2107 | { "crnl-glob", 0, 40, 1, "" }, |
| 2108 | { "default-perms", 0, 16, 0, "u" }, |
| 2109 | { "diff-binary", 0, 0, 0, "on" }, |
| 2110 | { "diff-command", 0, 40, 0, "" }, |
| 2111 | { "dont-push", 0, 0, 0, "off" }, |
| @@ -2165,10 +2165,14 @@ | |
| 2165 | ** allow-symlinks If enabled, don't follow symlinks, and instead treat |
| 2166 | ** (versionable) them as symlinks on Unix. Has no effect on Windows |
| 2167 | ** (existing links in repository created on Unix become |
| 2168 | ** plain-text files with link destination path inside). |
| 2169 | ** Default: off |
| 2170 | ** |
| 2171 | ** allow-clean-x If enabled, allow the --extreme option to be used in |
| 2172 | ** the clean command. |
| 2173 | ** Default: off |
| 2174 | ** |
| 2175 | ** auto-captcha If enabled, the Login page provides a button to |
| 2176 | ** fill in the captcha password. Default: on |
| 2177 | ** |
| 2178 | ** auto-hyperlink Use javascript to enable hyperlinks on web pages |
| @@ -2193,15 +2197,10 @@ | |
| 2197 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2198 | ** care considered distinct. If FALSE files whose names |
| 2199 | ** differ only in case are the same file. Defaults to |
| 2200 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2201 | ** |
| 2202 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2203 | ** with gpg. When disabled (the default), commits will |
| 2204 | ** be unsigned. Default: off |
| 2205 | ** |
| 2206 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| @@ -2251,15 +2250,15 @@ | |
| 2250 | ** even if the login page request came via HTTP. |
| 2251 | ** |
| 2252 | ** ignore-glob The VALUE is a comma or newline-separated list of GLOB |
| 2253 | ** (versionable) patterns specifying files that the "add", "addremove", |
| 2254 | ** "clean", and "extra" commands will ignore. |
| 2255 | ** Example: *.log *.a *.lib *.o |
| 2256 | ** |
| 2257 | ** keep-glob The VALUE is a comma or newline-separated list of GLOB |
| 2258 | ** (versionable) patterns specifying files that the "clean" command will |
| 2259 | ** keep. Example: *.log customCode.c notes.txt |
| 2260 | ** |
| 2261 | ** localauth If enabled, require that HTTP connections from |
| 2262 | ** 127.0.0.1 be authenticated by password. If |
| 2263 | ** false, all HTTP requests from localhost have |
| 2264 | ** unrestricted access to the repository. |
| 2265 |
M
src/db.c
+7
-8
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2089,10 +2089,11 @@ | ||
| 2089 | 2089 | char const *def; /* Default value */ |
| 2090 | 2090 | }; |
| 2091 | 2091 | #endif /* INTERFACE */ |
| 2092 | 2092 | struct stControlSettings const ctrlSettings[] = { |
| 2093 | 2093 | { "access-log", 0, 0, 0, "off" }, |
| 2094 | + { "allow-clean-x", 0, 0, 0, "off" }, | |
| 2094 | 2095 | { "allow-symlinks",0, 0, 1, "off" }, |
| 2095 | 2096 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 2096 | 2097 | { "auto-hyperlink",0, 0, 0, "on", }, |
| 2097 | 2098 | { "auto-shun", 0, 0, 0, "on" }, |
| 2098 | 2099 | { "autosync", 0, 0, 0, "on" }, |
| @@ -2101,11 +2102,10 @@ | ||
| 2101 | 2102 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) |
| 2102 | 2103 | { "case-sensitive",0, 0, 0, "off" }, |
| 2103 | 2104 | #else |
| 2104 | 2105 | { "case-sensitive",0, 0, 0, "on" }, |
| 2105 | 2106 | #endif |
| 2106 | - { "clean-glob", 0, 40, 1, "" }, | |
| 2107 | 2107 | { "crnl-glob", 0, 40, 1, "" }, |
| 2108 | 2108 | { "default-perms", 0, 16, 0, "u" }, |
| 2109 | 2109 | { "diff-binary", 0, 0, 0, "on" }, |
| 2110 | 2110 | { "diff-command", 0, 40, 0, "" }, |
| 2111 | 2111 | { "dont-push", 0, 0, 0, "off" }, |
| @@ -2165,10 +2165,14 @@ | ||
| 2165 | 2165 | ** allow-symlinks If enabled, don't follow symlinks, and instead treat |
| 2166 | 2166 | ** (versionable) them as symlinks on Unix. Has no effect on Windows |
| 2167 | 2167 | ** (existing links in repository created on Unix become |
| 2168 | 2168 | ** plain-text files with link destination path inside). |
| 2169 | 2169 | ** Default: off |
| 2170 | +** | |
| 2171 | +** allow-clean-x If enabled, allow the --extreme option to be used in | |
| 2172 | +** the clean command. | |
| 2173 | +** Default: off | |
| 2170 | 2174 | ** |
| 2171 | 2175 | ** auto-captcha If enabled, the Login page provides a button to |
| 2172 | 2176 | ** fill in the captcha password. Default: on |
| 2173 | 2177 | ** |
| 2174 | 2178 | ** auto-hyperlink Use javascript to enable hyperlinks on web pages |
| @@ -2193,15 +2197,10 @@ | ||
| 2193 | 2197 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2194 | 2198 | ** care considered distinct. If FALSE files whose names |
| 2195 | 2199 | ** differ only in case are the same file. Defaults to |
| 2196 | 2200 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2197 | 2201 | ** |
| 2198 | -** clean-glob The VALUE is a comma or newline-separated list of GLOB | |
| 2199 | -** (versionable) patterns specifying files that the "clean" command will | |
| 2200 | -** delete without prompting even when the -force flag has | |
| 2201 | -** not been used. Example: *.a *.lib *.o | |
| 2202 | -** | |
| 2203 | 2202 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2204 | 2203 | ** with gpg. When disabled (the default), commits will |
| 2205 | 2204 | ** be unsigned. Default: off |
| 2206 | 2205 | ** |
| 2207 | 2206 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| @@ -2251,15 +2250,15 @@ | ||
| 2251 | 2250 | ** even if the login page request came via HTTP. |
| 2252 | 2251 | ** |
| 2253 | 2252 | ** ignore-glob The VALUE is a comma or newline-separated list of GLOB |
| 2254 | 2253 | ** (versionable) patterns specifying files that the "add", "addremove", |
| 2255 | 2254 | ** "clean", and "extra" commands will ignore. |
| 2256 | -** Example: *.log customCode.c notes.txt | |
| 2255 | +** Example: *.log *.a *.lib *.o | |
| 2257 | 2256 | ** |
| 2258 | 2257 | ** keep-glob The VALUE is a comma or newline-separated list of GLOB |
| 2259 | 2258 | ** (versionable) patterns specifying files that the "clean" command will |
| 2260 | -** keep. | |
| 2259 | +** keep. Example: *.log customCode.c notes.txt | |
| 2261 | 2260 | ** |
| 2262 | 2261 | ** localauth If enabled, require that HTTP connections from |
| 2263 | 2262 | ** 127.0.0.1 be authenticated by password. If |
| 2264 | 2263 | ** false, all HTTP requests from localhost have |
| 2265 | 2264 | ** unrestricted access to the repository. |
| 2266 | 2265 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2089,10 +2089,11 @@ | |
| 2089 | char const *def; /* Default value */ |
| 2090 | }; |
| 2091 | #endif /* INTERFACE */ |
| 2092 | struct stControlSettings const ctrlSettings[] = { |
| 2093 | { "access-log", 0, 0, 0, "off" }, |
| 2094 | { "allow-symlinks",0, 0, 1, "off" }, |
| 2095 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 2096 | { "auto-hyperlink",0, 0, 0, "on", }, |
| 2097 | { "auto-shun", 0, 0, 0, "on" }, |
| 2098 | { "autosync", 0, 0, 0, "on" }, |
| @@ -2101,11 +2102,10 @@ | |
| 2101 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) |
| 2102 | { "case-sensitive",0, 0, 0, "off" }, |
| 2103 | #else |
| 2104 | { "case-sensitive",0, 0, 0, "on" }, |
| 2105 | #endif |
| 2106 | { "clean-glob", 0, 40, 1, "" }, |
| 2107 | { "crnl-glob", 0, 40, 1, "" }, |
| 2108 | { "default-perms", 0, 16, 0, "u" }, |
| 2109 | { "diff-binary", 0, 0, 0, "on" }, |
| 2110 | { "diff-command", 0, 40, 0, "" }, |
| 2111 | { "dont-push", 0, 0, 0, "off" }, |
| @@ -2165,10 +2165,14 @@ | |
| 2165 | ** allow-symlinks If enabled, don't follow symlinks, and instead treat |
| 2166 | ** (versionable) them as symlinks on Unix. Has no effect on Windows |
| 2167 | ** (existing links in repository created on Unix become |
| 2168 | ** plain-text files with link destination path inside). |
| 2169 | ** Default: off |
| 2170 | ** |
| 2171 | ** auto-captcha If enabled, the Login page provides a button to |
| 2172 | ** fill in the captcha password. Default: on |
| 2173 | ** |
| 2174 | ** auto-hyperlink Use javascript to enable hyperlinks on web pages |
| @@ -2193,15 +2197,10 @@ | |
| 2193 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2194 | ** care considered distinct. If FALSE files whose names |
| 2195 | ** differ only in case are the same file. Defaults to |
| 2196 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2197 | ** |
| 2198 | ** clean-glob The VALUE is a comma or newline-separated list of GLOB |
| 2199 | ** (versionable) patterns specifying files that the "clean" command will |
| 2200 | ** delete without prompting even when the -force flag has |
| 2201 | ** not been used. Example: *.a *.lib *.o |
| 2202 | ** |
| 2203 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2204 | ** with gpg. When disabled (the default), commits will |
| 2205 | ** be unsigned. Default: off |
| 2206 | ** |
| 2207 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| @@ -2251,15 +2250,15 @@ | |
| 2251 | ** even if the login page request came via HTTP. |
| 2252 | ** |
| 2253 | ** ignore-glob The VALUE is a comma or newline-separated list of GLOB |
| 2254 | ** (versionable) patterns specifying files that the "add", "addremove", |
| 2255 | ** "clean", and "extra" commands will ignore. |
| 2256 | ** Example: *.log customCode.c notes.txt |
| 2257 | ** |
| 2258 | ** keep-glob The VALUE is a comma or newline-separated list of GLOB |
| 2259 | ** (versionable) patterns specifying files that the "clean" command will |
| 2260 | ** keep. |
| 2261 | ** |
| 2262 | ** localauth If enabled, require that HTTP connections from |
| 2263 | ** 127.0.0.1 be authenticated by password. If |
| 2264 | ** false, all HTTP requests from localhost have |
| 2265 | ** unrestricted access to the repository. |
| 2266 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2089,10 +2089,11 @@ | |
| 2089 | char const *def; /* Default value */ |
| 2090 | }; |
| 2091 | #endif /* INTERFACE */ |
| 2092 | struct stControlSettings const ctrlSettings[] = { |
| 2093 | { "access-log", 0, 0, 0, "off" }, |
| 2094 | { "allow-clean-x", 0, 0, 0, "off" }, |
| 2095 | { "allow-symlinks",0, 0, 1, "off" }, |
| 2096 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 2097 | { "auto-hyperlink",0, 0, 0, "on", }, |
| 2098 | { "auto-shun", 0, 0, 0, "on" }, |
| 2099 | { "autosync", 0, 0, 0, "on" }, |
| @@ -2101,11 +2102,10 @@ | |
| 2102 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) |
| 2103 | { "case-sensitive",0, 0, 0, "off" }, |
| 2104 | #else |
| 2105 | { "case-sensitive",0, 0, 0, "on" }, |
| 2106 | #endif |
| 2107 | { "crnl-glob", 0, 40, 1, "" }, |
| 2108 | { "default-perms", 0, 16, 0, "u" }, |
| 2109 | { "diff-binary", 0, 0, 0, "on" }, |
| 2110 | { "diff-command", 0, 40, 0, "" }, |
| 2111 | { "dont-push", 0, 0, 0, "off" }, |
| @@ -2165,10 +2165,14 @@ | |
| 2165 | ** allow-symlinks If enabled, don't follow symlinks, and instead treat |
| 2166 | ** (versionable) them as symlinks on Unix. Has no effect on Windows |
| 2167 | ** (existing links in repository created on Unix become |
| 2168 | ** plain-text files with link destination path inside). |
| 2169 | ** Default: off |
| 2170 | ** |
| 2171 | ** allow-clean-x If enabled, allow the --extreme option to be used in |
| 2172 | ** the clean command. |
| 2173 | ** Default: off |
| 2174 | ** |
| 2175 | ** auto-captcha If enabled, the Login page provides a button to |
| 2176 | ** fill in the captcha password. Default: on |
| 2177 | ** |
| 2178 | ** auto-hyperlink Use javascript to enable hyperlinks on web pages |
| @@ -2193,15 +2197,10 @@ | |
| 2197 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2198 | ** care considered distinct. If FALSE files whose names |
| 2199 | ** differ only in case are the same file. Defaults to |
| 2200 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2201 | ** |
| 2202 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2203 | ** with gpg. When disabled (the default), commits will |
| 2204 | ** be unsigned. Default: off |
| 2205 | ** |
| 2206 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| @@ -2251,15 +2250,15 @@ | |
| 2250 | ** even if the login page request came via HTTP. |
| 2251 | ** |
| 2252 | ** ignore-glob The VALUE is a comma or newline-separated list of GLOB |
| 2253 | ** (versionable) patterns specifying files that the "add", "addremove", |
| 2254 | ** "clean", and "extra" commands will ignore. |
| 2255 | ** Example: *.log *.a *.lib *.o |
| 2256 | ** |
| 2257 | ** keep-glob The VALUE is a comma or newline-separated list of GLOB |
| 2258 | ** (versionable) patterns specifying files that the "clean" command will |
| 2259 | ** keep. Example: *.log customCode.c notes.txt |
| 2260 | ** |
| 2261 | ** localauth If enabled, require that HTTP connections from |
| 2262 | ** 127.0.0.1 be authenticated by password. If |
| 2263 | ** false, all HTTP requests from localhost have |
| 2264 | ** unrestricted access to the repository. |
| 2265 |
-1
| --- src/json_config.c | ||
| +++ src/json_config.c | ||
| @@ -64,11 +64,10 @@ | ||
| 64 | 64 | |
| 65 | 65 | { "project-name", CONFIGSET_PROJ }, |
| 66 | 66 | { "project-description", CONFIGSET_PROJ }, |
| 67 | 67 | { "manifest", CONFIGSET_PROJ }, |
| 68 | 68 | { "binary-glob", CONFIGSET_PROJ }, |
| 69 | -{ "clean-glob", CONFIGSET_PROJ }, | |
| 70 | 69 | { "encoding-glob", CONFIGSET_PROJ }, |
| 71 | 70 | { "ignore-glob", CONFIGSET_PROJ }, |
| 72 | 71 | { "keep-glob", CONFIGSET_PROJ }, |
| 73 | 72 | { "crnl-glob", CONFIGSET_PROJ }, |
| 74 | 73 | { "empty-dirs", CONFIGSET_PROJ }, |
| 75 | 74 |
| --- src/json_config.c | |
| +++ src/json_config.c | |
| @@ -64,11 +64,10 @@ | |
| 64 | |
| 65 | { "project-name", CONFIGSET_PROJ }, |
| 66 | { "project-description", CONFIGSET_PROJ }, |
| 67 | { "manifest", CONFIGSET_PROJ }, |
| 68 | { "binary-glob", CONFIGSET_PROJ }, |
| 69 | { "clean-glob", CONFIGSET_PROJ }, |
| 70 | { "encoding-glob", CONFIGSET_PROJ }, |
| 71 | { "ignore-glob", CONFIGSET_PROJ }, |
| 72 | { "keep-glob", CONFIGSET_PROJ }, |
| 73 | { "crnl-glob", CONFIGSET_PROJ }, |
| 74 | { "empty-dirs", CONFIGSET_PROJ }, |
| 75 |
| --- src/json_config.c | |
| +++ src/json_config.c | |
| @@ -64,11 +64,10 @@ | |
| 64 | |
| 65 | { "project-name", CONFIGSET_PROJ }, |
| 66 | { "project-description", CONFIGSET_PROJ }, |
| 67 | { "manifest", CONFIGSET_PROJ }, |
| 68 | { "binary-glob", CONFIGSET_PROJ }, |
| 69 | { "encoding-glob", CONFIGSET_PROJ }, |
| 70 | { "ignore-glob", CONFIGSET_PROJ }, |
| 71 | { "keep-glob", CONFIGSET_PROJ }, |
| 72 | { "crnl-glob", CONFIGSET_PROJ }, |
| 73 | { "empty-dirs", CONFIGSET_PROJ }, |
| 74 |
+5
-8
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -436,12 +436,11 @@ | ||
| 436 | 436 | */ |
| 437 | 437 | void vfile_scan( |
| 438 | 438 | Blob *pPath, /* Directory to be scanned */ |
| 439 | 439 | int nPrefix, /* Number of bytes in directory name */ |
| 440 | 440 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 441 | - Glob *pIgnore1, /* Do not add files that match this GLOB */ | |
| 442 | - Glob *pIgnore2 /* Omit files matching this GLOB too */ | |
| 441 | + Glob *pIgnore /* Do not add files that match this GLOB */ | |
| 443 | 442 | ){ |
| 444 | 443 | DIR *d; |
| 445 | 444 | int origSize; |
| 446 | 445 | const char *zDir; |
| 447 | 446 | struct dirent *pEntry; |
| @@ -449,14 +448,13 @@ | ||
| 449 | 448 | static Stmt ins; |
| 450 | 449 | static int depth = 0; |
| 451 | 450 | void *zNative; |
| 452 | 451 | |
| 453 | 452 | origSize = blob_size(pPath); |
| 454 | - if( pIgnore1 || pIgnore2 ){ | |
| 453 | + if( pIgnore ){ | |
| 455 | 454 | blob_appendf(pPath, "/"); |
| 456 | - if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; | |
| 457 | - if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; | |
| 455 | + if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; | |
| 458 | 456 | blob_resize(pPath, origSize); |
| 459 | 457 | } |
| 460 | 458 | if( skipAll ) return; |
| 461 | 459 | |
| 462 | 460 | if( depth==0 ){ |
| @@ -481,16 +479,15 @@ | ||
| 481 | 479 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 482 | 480 | } |
| 483 | 481 | zUtf8 = fossil_filename_to_utf8(pEntry->d_name); |
| 484 | 482 | blob_appendf(pPath, "/%s", zUtf8); |
| 485 | 483 | zPath = blob_str(pPath); |
| 486 | - if( glob_match(pIgnore1, &zPath[nPrefix+1]) || | |
| 487 | - glob_match(pIgnore2, &zPath[nPrefix+1]) ){ | |
| 484 | + if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ | |
| 488 | 485 | /* do nothing */ |
| 489 | 486 | }else if( file_wd_isdir(zPath)==1 ){ |
| 490 | 487 | if( !vfile_top_of_checkout(zPath) ){ |
| 491 | - vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); | |
| 488 | + vfile_scan(pPath, nPrefix, scanFlags, pIgnore); | |
| 492 | 489 | } |
| 493 | 490 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 494 | 491 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 495 | 492 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 496 | 493 | db_step(&ins); |
| 497 | 494 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -436,12 +436,11 @@ | |
| 436 | */ |
| 437 | void vfile_scan( |
| 438 | Blob *pPath, /* Directory to be scanned */ |
| 439 | int nPrefix, /* Number of bytes in directory name */ |
| 440 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 441 | Glob *pIgnore1, /* Do not add files that match this GLOB */ |
| 442 | Glob *pIgnore2 /* Omit files matching this GLOB too */ |
| 443 | ){ |
| 444 | DIR *d; |
| 445 | int origSize; |
| 446 | const char *zDir; |
| 447 | struct dirent *pEntry; |
| @@ -449,14 +448,13 @@ | |
| 449 | static Stmt ins; |
| 450 | static int depth = 0; |
| 451 | void *zNative; |
| 452 | |
| 453 | origSize = blob_size(pPath); |
| 454 | if( pIgnore1 || pIgnore2 ){ |
| 455 | blob_appendf(pPath, "/"); |
| 456 | if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| 457 | if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| 458 | blob_resize(pPath, origSize); |
| 459 | } |
| 460 | if( skipAll ) return; |
| 461 | |
| 462 | if( depth==0 ){ |
| @@ -481,16 +479,15 @@ | |
| 481 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 482 | } |
| 483 | zUtf8 = fossil_filename_to_utf8(pEntry->d_name); |
| 484 | blob_appendf(pPath, "/%s", zUtf8); |
| 485 | zPath = blob_str(pPath); |
| 486 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 487 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 488 | /* do nothing */ |
| 489 | }else if( file_wd_isdir(zPath)==1 ){ |
| 490 | if( !vfile_top_of_checkout(zPath) ){ |
| 491 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 492 | } |
| 493 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 494 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 495 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 496 | db_step(&ins); |
| 497 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -436,12 +436,11 @@ | |
| 436 | */ |
| 437 | void vfile_scan( |
| 438 | Blob *pPath, /* Directory to be scanned */ |
| 439 | int nPrefix, /* Number of bytes in directory name */ |
| 440 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 441 | Glob *pIgnore /* Do not add files that match this GLOB */ |
| 442 | ){ |
| 443 | DIR *d; |
| 444 | int origSize; |
| 445 | const char *zDir; |
| 446 | struct dirent *pEntry; |
| @@ -449,14 +448,13 @@ | |
| 448 | static Stmt ins; |
| 449 | static int depth = 0; |
| 450 | void *zNative; |
| 451 | |
| 452 | origSize = blob_size(pPath); |
| 453 | if( pIgnore ){ |
| 454 | blob_appendf(pPath, "/"); |
| 455 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| 456 | blob_resize(pPath, origSize); |
| 457 | } |
| 458 | if( skipAll ) return; |
| 459 | |
| 460 | if( depth==0 ){ |
| @@ -481,16 +479,15 @@ | |
| 479 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 480 | } |
| 481 | zUtf8 = fossil_filename_to_utf8(pEntry->d_name); |
| 482 | blob_appendf(pPath, "/%s", zUtf8); |
| 483 | zPath = blob_str(pPath); |
| 484 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 485 | /* do nothing */ |
| 486 | }else if( file_wd_isdir(zPath)==1 ){ |
| 487 | if( !vfile_top_of_checkout(zPath) ){ |
| 488 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore); |
| 489 | } |
| 490 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 491 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 492 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 493 | db_step(&ins); |
| 494 |
+5
-8
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -436,12 +436,11 @@ | ||
| 436 | 436 | */ |
| 437 | 437 | void vfile_scan( |
| 438 | 438 | Blob *pPath, /* Directory to be scanned */ |
| 439 | 439 | int nPrefix, /* Number of bytes in directory name */ |
| 440 | 440 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 441 | - Glob *pIgnore1, /* Do not add files that match this GLOB */ | |
| 442 | - Glob *pIgnore2 /* Omit files matching this GLOB too */ | |
| 441 | + Glob *pIgnore /* Do not add files that match this GLOB */ | |
| 443 | 442 | ){ |
| 444 | 443 | DIR *d; |
| 445 | 444 | int origSize; |
| 446 | 445 | const char *zDir; |
| 447 | 446 | struct dirent *pEntry; |
| @@ -449,14 +448,13 @@ | ||
| 449 | 448 | static Stmt ins; |
| 450 | 449 | static int depth = 0; |
| 451 | 450 | void *zNative; |
| 452 | 451 | |
| 453 | 452 | origSize = blob_size(pPath); |
| 454 | - if( pIgnore1 || pIgnore2 ){ | |
| 453 | + if( pIgnore ){ | |
| 455 | 454 | blob_appendf(pPath, "/"); |
| 456 | - if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; | |
| 457 | - if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; | |
| 455 | + if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; | |
| 458 | 456 | blob_resize(pPath, origSize); |
| 459 | 457 | } |
| 460 | 458 | if( skipAll ) return; |
| 461 | 459 | |
| 462 | 460 | if( depth==0 ){ |
| @@ -481,16 +479,15 @@ | ||
| 481 | 479 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 482 | 480 | } |
| 483 | 481 | zUtf8 = fossil_filename_to_utf8(pEntry->d_name); |
| 484 | 482 | blob_appendf(pPath, "/%s", zUtf8); |
| 485 | 483 | zPath = blob_str(pPath); |
| 486 | - if( glob_match(pIgnore1, &zPath[nPrefix+1]) || | |
| 487 | - glob_match(pIgnore2, &zPath[nPrefix+1]) ){ | |
| 484 | + if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ | |
| 488 | 485 | /* do nothing */ |
| 489 | 486 | }else if( file_wd_isdir(zPath)==1 ){ |
| 490 | 487 | if( !vfile_top_of_checkout(zPath) ){ |
| 491 | - vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); | |
| 488 | + vfile_scan(pPath, nPrefix, scanFlags, pIgnore); | |
| 492 | 489 | } |
| 493 | 490 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 494 | 491 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 495 | 492 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 496 | 493 | db_step(&ins); |
| 497 | 494 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -436,12 +436,11 @@ | |
| 436 | */ |
| 437 | void vfile_scan( |
| 438 | Blob *pPath, /* Directory to be scanned */ |
| 439 | int nPrefix, /* Number of bytes in directory name */ |
| 440 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 441 | Glob *pIgnore1, /* Do not add files that match this GLOB */ |
| 442 | Glob *pIgnore2 /* Omit files matching this GLOB too */ |
| 443 | ){ |
| 444 | DIR *d; |
| 445 | int origSize; |
| 446 | const char *zDir; |
| 447 | struct dirent *pEntry; |
| @@ -449,14 +448,13 @@ | |
| 449 | static Stmt ins; |
| 450 | static int depth = 0; |
| 451 | void *zNative; |
| 452 | |
| 453 | origSize = blob_size(pPath); |
| 454 | if( pIgnore1 || pIgnore2 ){ |
| 455 | blob_appendf(pPath, "/"); |
| 456 | if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| 457 | if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| 458 | blob_resize(pPath, origSize); |
| 459 | } |
| 460 | if( skipAll ) return; |
| 461 | |
| 462 | if( depth==0 ){ |
| @@ -481,16 +479,15 @@ | |
| 481 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 482 | } |
| 483 | zUtf8 = fossil_filename_to_utf8(pEntry->d_name); |
| 484 | blob_appendf(pPath, "/%s", zUtf8); |
| 485 | zPath = blob_str(pPath); |
| 486 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 487 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 488 | /* do nothing */ |
| 489 | }else if( file_wd_isdir(zPath)==1 ){ |
| 490 | if( !vfile_top_of_checkout(zPath) ){ |
| 491 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 492 | } |
| 493 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 494 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 495 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 496 | db_step(&ins); |
| 497 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -436,12 +436,11 @@ | |
| 436 | */ |
| 437 | void vfile_scan( |
| 438 | Blob *pPath, /* Directory to be scanned */ |
| 439 | int nPrefix, /* Number of bytes in directory name */ |
| 440 | unsigned scanFlags, /* Zero or more SCAN_xxx flags */ |
| 441 | Glob *pIgnore /* Do not add files that match this GLOB */ |
| 442 | ){ |
| 443 | DIR *d; |
| 444 | int origSize; |
| 445 | const char *zDir; |
| 446 | struct dirent *pEntry; |
| @@ -449,14 +448,13 @@ | |
| 448 | static Stmt ins; |
| 449 | static int depth = 0; |
| 450 | void *zNative; |
| 451 | |
| 452 | origSize = blob_size(pPath); |
| 453 | if( pIgnore ){ |
| 454 | blob_appendf(pPath, "/"); |
| 455 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| 456 | blob_resize(pPath, origSize); |
| 457 | } |
| 458 | if( skipAll ) return; |
| 459 | |
| 460 | if( depth==0 ){ |
| @@ -481,16 +479,15 @@ | |
| 479 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 480 | } |
| 481 | zUtf8 = fossil_filename_to_utf8(pEntry->d_name); |
| 482 | blob_appendf(pPath, "/%s", zUtf8); |
| 483 | zPath = blob_str(pPath); |
| 484 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 485 | /* do nothing */ |
| 486 | }else if( file_wd_isdir(zPath)==1 ){ |
| 487 | if( !vfile_top_of_checkout(zPath) ){ |
| 488 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore); |
| 489 | } |
| 490 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 491 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 492 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 493 | db_step(&ins); |
| 494 |