.stignore - can't unignore a subfolder of an ignored folder

This post is based on the following (currently closed) ticket in the bug tracker: https://github.com/syncthing/syncthing/issues/3766

I am using syncthing 0.14.12 on Windows 7 x64.

Assume I am syncing a folder with the following subdirectory structure:

\aa \bb \cc —\xx —\yy —\zz \dd

Each subfolder contains one file named as subfolder.txt (i.e., \aa\aa.txt). In total, I have 7 folders and 7 files. I am using the following .stignore pattern:

!/bb !/cc/yy **

I expect to be syncing two files:

\bb\bb.txt \cc\yy\yy.txt

I added the directory to syncthing and the scanning proocedure resulted in only one subdir one file in the local state. Only \bb\bb.txt was synced.

I’ve tried different patterns to include \cc\yy\yy.txt in sync with no success. In the end I noticed the following effect. I temporarily added one line to .stignore and rescanned the folder:

!/bb !/cc/yy !/cc **

The local state showed 5 files and 5 folders as expected. Then I reverted back to the original .stignore and rescanned again. The local state displayed 2 files and 2 folders and both files were synced (as I originally wanted). However, a newly added file \cc\yy\yyy.txt still won’t show up in the local state and won’t be synced. If I delete yy.txt and rescan, it disappears from the local view and is deleted on the other side. If I recreate it, it is not synced.

  1. Is this behavior expected?
  2. If yes, is it possible to write a proper .stignore to sync all files in \cc\yy subfolder?

Yes, it is expected behaviour. You need to unignore each segment of the path individually, this is because unignoring things with double stars !**/foo/**/bar makes no sense. If we did not support double star it would be possible to do the dirty work for you.

OK, looks like I found the solution.

The following .stignore does exactly what is required.

!/bb !/cc/yy /cc/* !/cc **

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.