Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When doing a "fossil update" if files are removed from a directory, then try to delete that directory (if it is empty) at the end of the update, if the directory is not on the empty-dirs list. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | rmdir-on-update |
Files: | files | file ages | folders |
SHA3-256: |
43111aa93925ca10bae3503278387e07 |
User & Date: | drh 2019-02-26 01:22:48.248 |
Context
2019-02-26
| ||
20:03 | Fix the rmdir-on-update so that it works even if the update is occurring in a subdirectory of the repository. Do not remove the subdirectory that is the current working directory even if it is empty. ... (check-in: 3275a944 user: drh tags: rmdir-on-update) | |
01:22 | When doing a "fossil update" if files are removed from a directory, then try to delete that directory (if it is empty) at the end of the update, if the directory is not on the empty-dirs list. ... (check-in: 43111aa9 user: drh tags: rmdir-on-update) | |
2019-02-25
| ||
17:01 | Update the built-in SQLite to the latest trunk version that includes all of the fixes that were in the 3.27.2 release. ... (check-in: 4d608670 user: drh tags: trunk) | |
Changes
Changes to src/checkout.c.
︙ | ︙ | |||
301 302 303 304 305 306 307 | } db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( !keepFlag ){ vfile_to_disk(vid, 0, !g.fQuiet, promptFlag); } checkout_set_all_exe(vid); manifest_to_disk(vid); | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | } db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( !keepFlag ){ vfile_to_disk(vid, 0, !g.fQuiet, promptFlag); } checkout_set_all_exe(vid); manifest_to_disk(vid); ensure_empty_dirs_created(0); db_set_checkout(vid); undo_reset(); db_multi_exec("DELETE FROM vmerge"); if( !keepFlag && db_get_boolean("repo-cksum",1) ){ vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); vfile_aggregate_checksum_disk(vid, &cksum2); if( blob_compare(&cksum1, &cksum2) ){ |
︙ | ︙ |
Changes to src/file.c.
︙ | ︙ | |||
682 683 684 685 686 687 688 689 690 691 692 693 694 695 | rc = rmdir(zName); #endif fossil_path_free(zMbcs); return rc; } return 0; } /* ** Return true if the filename given is a valid filename for ** a file in a repository. Valid filenames follow all of the ** following rules: ** ** * Does not begin with "/" | > > > > > > > > > > > > > > > > > > > > | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | rc = rmdir(zName); #endif fossil_path_free(zMbcs); return rc; } return 0; } /* SQL Function: rmdir(NAME) ** ** Try to remove the directory NAME. Return zero on success and non-zero ** for failure. */ void file_rmdir_sql_function( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *zName = (const char*)sqlite3_value_text(argv[0]); int rc; if( zName==0 ){ rc = 1; }else{ rc = file_rmdir(zName); } sqlite3_result_int(context, rc); } /* ** Return true if the filename given is a valid filename for ** a file in a repository. Valid filenames follow all of the ** following rules: ** ** * Does not begin with "/" |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
158 159 160 161 162 163 164 | db_get_int("autosync-tries", 1), 1) ){ fossil_fatal("update abandoned due to sync failure"); } } /* Create any empty directories now, as well as after the update, ** so changes in settings are reflected now */ | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | db_get_int("autosync-tries", 1), 1) ){ fossil_fatal("update abandoned due to sync failure"); } } /* Create any empty directories now, as well as after the update, ** so changes in settings are reflected now */ if( !dryRunFlag ) ensure_empty_dirs_created(0); if( internalUpdate ){ tid = internalUpdate; }else if( g.argc>=3 ){ if( fossil_strcmp(g.argv[2], "current")==0 ){ /* If VERSION is "current", then use the same algorithm to find the ** target as if VERSION were omitted. */ |
︙ | ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 | } if( tid==0 ){ return; } db_begin_transaction(); vfile_check_signature(vid, CKSIG_ENOTFILE); if( !dryRunFlag && !internalUpdate ) undo_begin(); if( load_vfile_from_rid(tid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to update"); }; /* | > > > > | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | } if( tid==0 ){ return; } db_begin_transaction(); db_multi_exec( "CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID", filename_collation() ); vfile_check_signature(vid, CKSIG_ENOTFILE); if( !dryRunFlag && !internalUpdate ) undo_begin(); if( load_vfile_from_rid(tid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to update"); }; /* |
︙ | ︙ | |||
453 454 455 456 457 458 459 | ** file but keep the edited version around. */ fossil_print("CONFLICT %s - edited locally but deleted by update\n", zName); nConflict++; }else{ fossil_print("REMOVE %s\n", zName); if( !dryRunFlag && !internalUpdate ) undo_save(zName); | | > > > > > > > > > > > > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | ** file but keep the edited version around. */ fossil_print("CONFLICT %s - edited locally but deleted by update\n", zName); nConflict++; }else{ fossil_print("REMOVE %s\n", zName); if( !dryRunFlag && !internalUpdate ) undo_save(zName); if( !dryRunFlag ){ char *zDir; file_delete(zFullPath); zDir = file_dirname(zName); while( zDir!=0 ){ char *zNext; db_multi_exec("INSERT OR IGNORE INTO dir_to_delete(name)" "VALUES(%Q)", zDir); zNext = db_changes() ? file_dirname(zDir) : 0; fossil_free(zDir); zDir = zNext; } } } }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ /* Merge the changes in the current tree into the target version */ Blob r, t, v; int rc; if( nameChng ){ fossil_print("MERGE %s -> %s\n", zName, zNewName); |
︙ | ︙ | |||
564 565 566 567 568 569 570 | /* ** Clean up the mid and pid VFILE entries. Then commit the changes. */ if( dryRunFlag ){ db_end_transaction(1); /* With --dry-run, rollback changes */ }else{ | | > > > > > | | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | /* ** Clean up the mid and pid VFILE entries. Then commit the changes. */ if( dryRunFlag ){ db_end_transaction(1); /* With --dry-run, rollback changes */ }else{ ensure_empty_dirs_created(1); sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0, file_rmdir_sql_function, 0, 0); db_multi_exec( "SELECT rmdir(name) FROM dir_to_delete ORDER BY name DESC" ); if( g.argc<=3 ){ /* All files updated. Shift the current checkout to the target. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid); checkout_set_all_exe(tid); manifest_to_disk(tid); db_set_checkout(tid); }else{ /* A subset of files have been checked out. Keep the current ** checkout unchanged. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); } if( !internalUpdate ) undo_finish(); if( setmtimeFlag ) vfile_check_signature(tid, CKSIG_SETMTIME); db_end_transaction(0); } } /* ** Create empty directories specified by the empty-dirs setting. */ void ensure_empty_dirs_created(int clearDirTable){ char *zEmptyDirs = db_get("empty-dirs", 0); if( zEmptyDirs!=0 ){ int i; Blob dirName; Blob dirsList; zEmptyDirs = fossil_strdup(zEmptyDirs); |
︙ | ︙ | |||
611 612 613 614 615 616 617 | if( file_mkfolder(zPath, RepoFILE, 0, 1)!=0 ) { fossil_warning("couldn't create directory %s as " "required by empty-dirs setting", zDir); } break; } case 1: { /* exists, and is a directory */ | | > > > > > | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | if( file_mkfolder(zPath, RepoFILE, 0, 1)!=0 ) { fossil_warning("couldn't create directory %s as " "required by empty-dirs setting", zDir); } break; } case 1: { /* exists, and is a directory */ /* make sure this directory is not on the delete list */ if( clearDirTable ){ db_multi_exec( "DELETE FROM dir_to_delete WHERE name=%Q", zDir ); } break; } case 2: { /* exists, but isn't a directory */ fossil_warning("file %s found, but a directory is required " "by empty-dirs setting", zDir); } } |
︙ | ︙ |