mv: add --swap (-x) option to atomically swap 2 paths
commit6cd2d5e5335b5c286ff39e154e9dd38ba6923775
authorPetr Malat <oss@malat.biz>
Thu, 29 Feb 2024 22:02:03 +0000 (29 23:02 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 3 Mar 2024 12:18:45 +0000 (3 12:18 +0000)
treece79f64329c4e94cb10e7bc59e7866bd8a127f36
parentfcfba90d0d27a1bacf2020bac4dbec74ed181028
mv: add --swap (-x) option to atomically swap 2 paths

renameat2() syscall allows atomically swapping 2 paths on one
file system. Expose this ability to the user with --swap.

* doc/coreutils.texi: Describe mv --swap option.
* src/mv.c (main): Support --swap.
* tests/mv/mv-swap.sh: Add test for mv -x.
* tests/local.mk: Reference new test.
* NEWS: Mention the new option.
NEWS
doc/coreutils.texi
src/mv.c
tests/local.mk
tests/mv/mv-swap.sh [new file with mode: 0755]