Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Except pattern is not honored #3

Closed
AforDesign opened this issue Jan 13, 2021 · 4 comments
Closed

Except pattern is not honored #3

AforDesign opened this issue Jan 13, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@AforDesign
Copy link

I've been experimenting with patterns to target certain files and folders and noticed the except pattern is ignored.

Steps to reproduce

Add these lines in .dropboxignore

name_folder/
!name_folder/name_stuff_to_keep

Expected result:
The 'name_folder' should be ignored by DropBox with the exception of files and folders matching 'name_stuff_to_keep' and thus the folder 'name_folder' itself.

@sp1thas sp1thas added the bug Something isn't working label Jan 13, 2021
@sp1thas sp1thas self-assigned this Jan 13, 2021
@sp1thas
Copy link
Owner

sp1thas commented Jan 15, 2021

@AforDesign really tricky case, thanks for reporting this.

Based on the official announcement:

Once a folder is ignored, all files and folders inside it are also ignored.

as a result, when name_folder is ignored, name_stuff_to_keep will be ignored by default. Even if I manually revert name_stuff_to_keep, the folder will remain ignored because of the ignored parent folder.

therefore, exceptions could not be supported. I will make a fix in order to ignore exception patterns on both $ dropboxignore generate and $ dropboxignore ignore. A warning message will be displayed.

Unfortunately, regarding your case, you have to explicitly specify which sub-folders should be ignored except name_stuff_to_keep.

@AforDesign
Copy link
Author

ah yes... now I remember.
I've experimented with this in the past and DropBox ignore rules do work a bit different.
DropBox should invert check the document tree (bottom up), but does it the (lazy) other way around (top down).

For me personal it's not a problem.
I made one general dropboxignore file in my top folder which honours DropBox' ways.
It takes a bit more work to set up, but it's workable and well worth it.

As your purpose of the script was to inherit and mimic the gitignore file, you might want to reconsider some changes, warnings and disclaimers.
If people realise they're missing files in their DropBox, they might react unpleasant.
Also, most people propably don't want to ignore every rule that's in the ignore file (I guess).

For example: until last year I synced my entire workflow with all projects between my workspace at home and at my office.
This would've been a disaster when switching workstations.

My advice would be to NOT ignore folders in which files/folders are targeted with exception rules.
And don't give users an option for this until there's a workaround.
They might forget about it after a while.

@sp1thas
Copy link
Owner

sp1thas commented Jan 15, 2021

Thank you for sharing your experiences and your thoughts on this. You are totally right, the number one priority should be to prevent any unpleasant data losses. For now, any .dropboxignore file with at least one exception pattern will be completely bypassed. A warning message will urge the user to remove exception pattern(s) from this file and to explicitly define different matching patterns.

In the future, I hope to find a more gitignore-like approach to handle exceptions.

Also I will make more clear on documentation that $ dropboxingore generate is an optional step.

@sp1thas
Copy link
Owner

sp1thas commented Jan 21, 2021

Currently, dropboxignore does not support exceptional patterns. I'm closing this issue, but feel free to re-open it when the corresponding feature is implemented.

@sp1thas sp1thas closed this as completed Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants