.stignore: optional include

I use .stignore.sync and various .stignore files in subfolders to sync ignore settings across device, and #include them in .stignore. the .stignore.sync file is like this:

#include myrepo/.stignore
#include .stignore.symlinks

But sometimes the included files are synced later than the .stignore.sync, causing the whole folder to halt.

I think it’d be good if we have an optional include that just omit when the file not exist. e.g. #include? file. This way I can also set the default ignore pattern for all my folders to #include? .stignore.sync, sparing the chore to manually setup .stignore files.

For now, as a workaround, what you can do is to use

!/myrepo/.stignore
!/.stignore.symlinks
/

first (i.e. ignore everything but the two #include files), then switch to your usual ignore patterns once the two files have been synced.

1 Like

I don’t remember exactly what the outcome was, but there was at least a proposed PR for making sure that included ignore files are synced first. That won’t help if it exists on no other device, but it would allow parsing the full ignore patterns instead of halting in error state. Sorry I can’t look for the code / PR right now.

1 Like

It’s feat: load remote ignore patterns (fixes #9352) by calmh · Pull Request #10669 · syncthing/syncthing · GitHub