3

I have the following instruction in my unison profile:

ignore = Path node_modules
ignorenot = Path node_modules/scaffold

Easy enough, right? Except that it doesn't work. It keeps on ignoring the node_modules/scaffold folder.

I even tried it with a regex:

ignorenot = Regex /node_modules/scaffold/.*

So what's going on here? I'm running unison 2.48.4

Jelle De Loecker
  • 20,999
  • 27
  • 100
  • 142
  • 1
    I think this quote from the [Unison manual](https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html) addresses what's going wrong here: "*Note that the semantics of `ignore` and `ignorenot` is a little counter-intuitive. When detecting updates, Unison examines paths in depth-first order, starting from the roots of the replicas and working downwards. Before examining each path, it checks whether it matches `ignore` and does not match `ignorenot`;...* – Mike Pierce Jul 07 '20 at 03:34
  • 1
    *... in this case it skips this path and all its descendants. This means that, if some parent of a given path matches an `ignore` pattern, then it will be skipped even if the path itself matches an `ignorenot` pattern. In particular, putting `ignore = Path *` in your profile and then using `ignorenot` to select particular paths to be synchronized will not work. Instead, you should use the `path` preference to choose particular paths to synchronize.*" – Mike Pierce Jul 07 '20 at 03:35
  • Oh, that explains it. When I change the `ignore` to `ignore = Path node_modules/*`, the ignorenot DOES work. – Jelle De Loecker Jul 08 '20 at 13:59

1 Answers1

3

Apparently, when you ignore a directory, there is no way to un-ignore a descendant.

What you should do instead is ignore the directory's contents, and then un-ignore a specific child. This will work for example:

ignore = Path node_modules/*
ignorenot = Path node_modules/scaffold
Jelle De Loecker
  • 20,999
  • 27
  • 100
  • 142