Repository navigation
mv: don't skip a directory source with -u - #17011
seragAhmed wants to merge 2 commits into
Conversation
--update only skips a non-directory whose destination is not older. A directory onto an existing empty directory with a newer or equal timestamp was skipped silently, leaving everything in the source.
Merging this PR will regress 2 benchmarks1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
|
|
||
| assert!(!at.dir_exists("release")); | ||
| assert_eq!(at.read("stage/release/manifest"), "package\n"); | ||
| } |
There was a problem hiding this comment.
could you please also add a case where stage/release isn't empty? it should fail now instead of silently skipping
There was a problem hiding this comment.
Added in 2f935ed: test_mv_update_dir_onto_newer_non_empty_dir_fails puts a file in stage/release, and mv -u release stage now fails with "Directory not empty" and leaves both directories as they were.
mv -u dir dest/returned early whendest/dirwas an existing directory at least as new as the source, so nothing was moved and nothing was reported. The GNU manual limits the-utimestamp skip to non-directory sources, and GNU mv does move the directory here.The check now only skips when the source isn't a directory; a directory always goes on to the rename, which still fails if the destination directory isn't empty. Added a Unix test that sets the source directory's mtime to the epoch and moves it onto a fresh empty directory.
Fixes #17003