-
Notifications
You must be signed in to change notification settings - Fork 364
Do not allow moving a folder into itself #1173
Conversation
Found a regression: You can't copy |
Ok, good to know. That's different than the behavior that Windows exhibits (which is not surprising, considering its symlink support). I think I will defer to the macOS implementation for symlinks. |
These specs can probably be cleaned up a bit
c2aa454
to
9315040
Compare
@50Wliu: I can take a look at this pull request this week and try to get it merged. Would you be willing to summarize the verification process that you've used to verify that these changes have the desired effects? |
@jasonrudolph Sorry for the delay! Here's the test plan I came up with.
Now, create a symlink
To the best of my recollection, that's how I tested this PR when I first created it. If you'd like to see some other tests, please let me know. |
@50Wliu: When you have a moment, would you mind merging master into this branch and resolving the merge conflicts? |
Thanks, @50Wliu. Those tests all seems useful, and I'd like to recommend a few additional ones:
Do those tests seem reasonable? If so, I recommend the following next steps:
Edit by @rsese: copy ➡️ move for the second test per #1173 (comment) |
Assuming for the last bullet point you meant "attempt to move", then the test plan passes on Windows. |
Went through the verification process on macOS 10.12.6 and Ubuntu 16.04 - only 1 of the tests didn't have the expected result:
On both macOS and Ubuntu, the operation completes without an error notification or anything in devtools console, but GIF-age on macOS (behavior is the same on Ubuntu): All the other tests had the expected results but let me know if I misunderstood anything with this last test @50Wliu. |
@rsese instead of using a relative path for the symlink, can you try specifying the absolute path to |
Description of the Change
Do not allow any recursive copying, such as when attempting to copy
test/a
intotest/a/b
. Before this PR, such actions would be allowed and would result in aa/b/a/b/a/b/a/b/...
infinite directory structure. Drag-and-dropping previously emitted a non-obvious warning (cannot rename a to a/b
). Both now emit a "Cannot paste/move a folder into itself" warning and return without performing any additional actions.As a side effect of this change, Tree View no longer allows copying a directory directly inside itself, such as from
a/
toa/
(resulting ina/a/
). This is consistent with behavior on Windows.Alternate Designs
Carefully copy the folder structure once instead of recursively. This is much harder to implement and is also not what major OSes do.
Benefits
This fixes a usability issue where you would be unintentionally left with a massive folder structure (unable to be deleted on Windows through conventional means) that freezes Atom.
Possible Drawbacks
The only negative impact I can think of is pasting folders directly inside themselves no longer works.
Applicable Issues
Fixes #509
Refs #656, but I do not believe that this PR fixes that issue
Supersedes and closes #952
/cc @Ben3eeE @ungb: I'm interested in seeing whether or not pasting folders directly inside themselves works on macOS and Linux. Also, I haven't tested this with symlinks.