Fossil

Check-in [3275a944]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rmdir-on-update
Files: files | file ages | folders
SHA3-256:3275a94436cd9ea56707508709cac95eedb64b181278794d03f5991d9a15719a
User & Date: drh 2019-02-26 20:03:49
Context
2019-02-26
20:35
Enhance the "fossil checkout" command to that it too cleans up directories that it makes empty. check-in: 95b700c2 user: drh tags: rmdir-on-update
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/update.c.

580
581
582
583
584
585
586

587
588
589


590
591


592
593
594
595
596
597
598

  /*
  ** 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);







>



>
>

|
>
>







580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603

  /*
  ** Clean up the mid and pid VFILE entries.  Then commit the changes.
  */
  if( dryRunFlag ){
    db_end_transaction(1);  /* With --dry-run, rollback changes */
  }else{
    char zPwd[2000];
    ensure_empty_dirs_created(1);
    sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0,
                            file_rmdir_sql_function, 0, 0);
    zPwd[0] = 0;
    file_getcwd(zPwd, sizeof(zPwd));
    db_multi_exec(
      "SELECT rmdir(%Q||name) FROM dir_to_delete"
      " WHERE (%Q||name)<>%Q ORDER BY name DESC",
      g.zLocalRoot, g.zLocalRoot, zPwd
    );
    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);