I typically set up my .stignore file with a single entry:
#include .stglobalignore
And that file has the usual suspects (.DS_Store, *.o, etc.)
This setup works pretty good but there are times when I want to adjust the ignore patterns for a machine. For example, if I only want to sync a couple subfolders, I do this:
My question is when the .stignore file is altered and syncthing is already running, is that detected and the ignore pattern adjusted, or do I have to restart syncthing to have the updated ignore pattern take effect?
Related:
Two machines, pc1 and pc2. On pc1, shared folder foo has a subdirectory I want to sync, but also some sub-sub directories that I don’t want to be sync’d (think large build directories). I know I can add (?d)/foo/build* to pc2’s .stignore file and it’ll happily ignore (and delete any files that did get through before the change), but what if I have that line in pc1’s .stignore? Does syncthing make a distinction between /foo/build/abcd when it was locally created and /foo/build/abcd coming in from a syncthing peer? i.e. will syncthing delete /foo/build/abcd on pc1 if that line is in pc1’s .stignore?
Changes to the ignore patterns are detected before each scan or sync operation.
Syncthing never deletes anything that is added to an ignore file, if it’s already there it’s there and you’ll need to delete it manually after ignoring. (Or leaving it un-ignored, deleting it somewhere and letting that sync, and then deleting it.)
One thing I’m still not certain about, perhaps my description was unclear in that pc1/pc2 scenario. If I have (?d)/foo/build* in pc1’s .stignore and I create a file on pc1 (e.g. /foo/build/abc) – will syncthing delete that file (since it’s ignored) or are ignore patterns only checked for syncthing’s own sync operations? I think I know the answer but want to make sure. Given these scenarios and that ignore pattern on pc1, do I have things correct?
pc1 creates/writes/updates /foo/build/abc - syncthing doesn’t do anything with the file since it’s been created/modified outside of syncthing
pc2 creates/writes/updates /foo/build/123 - syncthing won’t sync it to pc1 since it’s ignored
Finally, I saw it mentioned elsewhere that ignore patterns can be thought of as an INCOMING (or receiver) feature – pc1 will still try to SEND changes that match /foo/build* to any peers that it is sharing /foo with, but any receiver with that pattern in its .stignore will ignore files matching the pattern. Is that accurate?