fix(trash.py): Initial commit trying to fix IsDirectoryError#1
fix(trash.py): Initial commit trying to fix IsDirectoryError#1Klairm wants to merge 1 commit intojorio:masterfrom
Conversation
When trying to discard files that are directories, the IsDirectoryError is thrown
|
Good catch! Thank you for the PR. Deleting an untracked tree is an edge case that I hadn't considered. Thinking about it, I think I'd create a tarball of the deleted tree and save that in the trash instead of copying the tree. That way it won't throw off the trash's file count model, and cleanup would be easier (os.unlink won't work on directories). But beyond the trash mechanism, the actual deletion task (DiscardFiles) ultimately calls into pygit2's checkout_index, which apparently has no effect on untracked trees. I'll think about how to solve this! |
|
726d515 backs up an untracked tree as a tarball (if it's smaller than the threshold in Settings > Trash) and deletes the tree from the working directory. Thank you for raising this! I've also noted that attempting to discard the deletion of a non-submodule tree currently errors out as well, so I'll fix that next. Feel free to open a new issue if you find more problems with trees (or anything else). |
You're welcome! I wanted to contribute if possible but don't have much time at the moment, glad you fixed! Since I'll be using the program I'll open a issue when needed 😄 |
Currently when trying to discard files that are directories, the IsDirectoryError is thrown.
The current commit fixes the error and creates correctly the backup files, but I haven't been able to locate where the removing is performed in all the codebase, so that part is still missing.