Updating .stignore docs re relative vs. absolute

Reading Ignoring Files — Syncthing v1 documentation, I noticed it doesn’t have an example of a rooted pattern. In a .gitignore, the pattern Documents is relative, and will match any file, directory or symlink with that name, at any directory level. The pattern /Documents will match any file, directory, or symlink in the current directory only. And the pattern /Documents/ will only match a directory in the current directory.

If someone can explain how Syncthing would handle these examples, I will craft a PR to update the docs. For example, is Documents rooted, and to make relative, you need to use **/Documents?

1 Like

From personal testing,

  1. /Documents will match only Documents in the Syncthing root folder.
  2. */Documents will match subfolder Documents (no need for **).
  3. Documents/ will match subfolders of Documents. This is same as Documents/* or Documents/**, i.e. the wildcards are superfluous in this case.

So, a unrooted Documents matches /ex/Documents? That seems to be the case, given my very limited testing.

1 Like

Yep. Just Documents will match everywhere.