github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/cmd/bisync/testdata/test_createemptysrcdirs/scenario.txt (about) 1 test createemptysrcdirs 2 # Test the --create-empty-src-dirs logic. 3 # Should behave the same way as rclone sync. 4 # Without this flag, empty directories created/deleted on one side are NOT created/deleted on the other side 5 # With this flag, empty directories created/deleted on one side are created/deleted on the other side; the result should be an exact mirror. 6 # 7 # Placeholders are necessary to ensure that git does not lose our empty folders 8 # After the initial setup sync: 9 # 1. Create an empty dir on Path1 by creating subdir/placeholder.txt and then deleting the placeholder 10 # 2. Run bisync without --create-empty-src-dirs 11 # 3. Confirm the subdir exists only on Path1 and not Path2 12 # 4. Run bisync WITH --create-empty-src-dirs 13 # 5. Confirm the subdir exists on both paths 14 # 6. Delete the empty dir on Path1 using purge-children (and also add files so the path isn't empty) 15 # 7. Run bisync without --create-empty-src-dirs 16 # 8. Confirm the subdir exists only on Path2 and not Path1 17 # 9. Reset, do the delete again, and run bisync WITH --create-empty-src-dirs 18 # 10. Confirm the subdir has been removed on both paths 19 20 test initial bisync 21 touch-glob 2001-01-02 {datadir/} placeholder.txt 22 copy-as {datadir/}placeholder.txt {path1/} file1.txt 23 copy-as {datadir/}placeholder.txt {path1/} file1.copy1.txt 24 copy-as {datadir/}placeholder.txt {path1/} file1.copy2.txt 25 copy-as {datadir/}placeholder.txt {path1/} file1.copy3.txt 26 copy-as {datadir/}placeholder.txt {path1/} file1.copy4.txt 27 copy-as {datadir/}placeholder.txt {path1/} file1.copy5.txt 28 bisync resync 29 30 test 1. Create an empty dir on Path1 by creating subdir/placeholder.txt and then deleting the placeholder 31 copy-as {datadir/}placeholder.txt {path1/} subdir/placeholder.txt 32 touch-glob 2001-01-02 {path1/} subdir 33 delete-file {path1/}subdir/placeholder.txt 34 35 test 2. Run bisync without --create-empty-src-dirs 36 bisync 37 38 test 3. Confirm the subdir exists only on Path1 and not Path2 39 list-dirs {path1/} 40 list-dirs {path2/} 41 42 test 4.Run bisync WITH --create-empty-src-dirs 43 bisync create-empty-src-dirs 44 45 test 5. Confirm the subdir exists on both paths 46 list-dirs {path1/} 47 list-dirs {path2/} 48 49 test 6. Delete the empty dir on Path1 using purge-children (and also add files so the path isn't empty) 50 purge-children {path1/} 51 copy-as {datadir/}placeholder.txt {path1/} file1.txt 52 copy-as {datadir/}placeholder.txt {path1/} file1.copy1.txt 53 copy-as {datadir/}placeholder.txt {path1/} file1.copy2.txt 54 copy-as {datadir/}placeholder.txt {path1/} file1.copy3.txt 55 copy-as {datadir/}placeholder.txt {path1/} file1.copy4.txt 56 copy-as {datadir/}placeholder.txt {path1/} file1.copy5.txt 57 58 test 7. Run bisync without --create-empty-src-dirs 59 bisync 60 61 test 8. Confirm the subdir exists only on Path2 and not Path1 62 list-dirs {path1/} 63 list-dirs {path2/} 64 65 test 9. Reset, do the delete again, and run bisync WITH --create-empty-src-dirs 66 bisync resync create-empty-src-dirs 67 list-dirs {path1/} 68 list-dirs {path2/} 69 70 purge-children {path1/} 71 copy-as {datadir/}placeholder.txt {path1/} file1.txt 72 copy-as {datadir/}placeholder.txt {path1/} file1.copy1.txt 73 copy-as {datadir/}placeholder.txt {path1/} file1.copy2.txt 74 copy-as {datadir/}placeholder.txt {path1/} file1.copy3.txt 75 copy-as {datadir/}placeholder.txt {path1/} file1.copy4.txt 76 copy-as {datadir/}placeholder.txt {path1/} file1.copy5.txt 77 list-dirs {path1/} 78 list-dirs {path2/} 79 80 bisync create-empty-src-dirs 81 82 test 10. Confirm the subdir has been removed on both paths 83 list-dirs {path1/} 84 list-dirs {path2/} 85 86 test 11. bisync again (because if we leave subdir in listings, test will fail due to mismatched modtime) 87 bisync create-empty-src-dirs