Skip to content

bug: dry run mode behaviour not align with actual run #75

Description

@VioletsOleander

Consider the following example:

Previous recnys.yaml:

{
    "foo/",
}

Current recnys.yaml:

{
    "foo/bar/",
}

Then run re, the operations will be:

  1. Unlink foo
  2. Link foo/bar

Those are ideally correct.

But run re --dry-run, the operations will be:

  1. Unlink foo
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions