Skip to content

Renaming a directory in a deeply nested path while executing a rename on a file will create a new nested directory if it doesn't exist #150

@nickjj

Description

@nickjj

If you rename a file that's in a nested directory and you decide to rename one of the nested directories to a name that doesn't exist yet, it will create a new directory instead of renaming the existing directory and your renamed file (even if the file name didn't change) will get located there.

Reproducible steps on Vim 8.1 using the latest master commit as of this issue's date:

  1. Create a test file in a deeply nested directory:
mkdir -p /tmp/testfern/foo/bar/baz \
  && cd /tmp/testfern \
  && touch foo/bar/baz/hello
  1. Open Vim with vim .

  2. Open the hello file with :e foo/bar/baz/hello

  3. Toggle and reveal hello in fern

  4. Execute fern-action-move on hello

  5. Notice how fern is asking you to rename the hello file

  6. Rename foo to foo2 in the destination path and but the leave the file name alone

You will end up with tmp/testfern/foo2/bar/baz/hello and /tmp/testfern/foo/bar/baz will be empty. The file was moved to a new directory instead of the existing foo directory being renamed to foo2.

I'll admit, I'm not 100% on what the expected behavior should be here. Personally I feel like it should probably rename the existing directory to foo2 without creating a new one. It's worth bringing up that if both foo and foo2 directories exist beforehand it will move the file between them as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationNeed better documentationhelp wantedExtra attention is neededwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions