Consider the following example:
Previous recnys.yaml:
Current recnys.yaml:
Then run re, the operations will be:
- Unlink foo
- Link foo/bar
Those are ideally correct.
But run re --dry-run, the operations will be:
- Unlink foo
- Error: path foo/bar is occupied, please remove it manually and try again
This is because the file existence check for dry-run mode and normal mode both
relies on the true file system tree on the disk, therefore, since in dry-run mode
operation 1 does not actually remove the symlink foo, operation 2 will still consider
foo/bar is an existent directory so that report an error.
The solution should be further isolate the logic of file system detection for dry-run
mode and normal mode, i.e. let dry-run mode maintain a fake file system in the memory.
Mark this as TODO.
Consider the following example:
Previous
recnys.yaml:Current
recnys.yaml:Then run
re, the operations will be:Those are ideally correct.
But run
re --dry-run, the operations will be:This is because the file existence check for dry-run mode and normal mode both
relies on the true file system tree on the disk, therefore, since in dry-run mode
operation 1 does not actually remove the symlink foo, operation 2 will still consider
foo/bar is an existent directory so that report an error.
The solution should be further isolate the logic of file system detection for dry-run
mode and normal mode, i.e. let dry-run mode maintain a fake file system in the memory.
Mark this as TODO.