3

Using version 2.51.2 (ocaml 4.04.0).

Trying to exclude a folder at the root (called build), but include any files ending in .err and .out at any depth underneath it.

Structure looks like

build/a/b/c/test/1.0/test.out
build/a/d/whatever/2.0/whatever.err
build/a/test.err

I tried

ignore = Path build
ignorenot = Regex·arnold-build\/(.*).(err|out)⬎

... this coughs up a "Malformed pattern" error. Also tried just to sync an entire subdir explicitly with this:

ignorenot = Path a/b/c/test/

But the "test" folder still doesn't sync.

How do I get just all the .err/.out files to sync, while ignoring everything else?

akevan
  • 691
  • 1
  • 9
  • 21

1 Answers1

2

Unison's "ignorenot" preference is somewhat counterintuitive

https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#ignore

If a directory is ignored, all its descendents are ignored too, everything below that tree will be ignored and not checked anymore.

Ignorenot only blocks ignores at the same level, so you must cover all the tree, up to the ignorenot you want to apply, with pairs of ignore and ignorenot. For example, in the case you cited above, if you want to ignore everything in build, except build/a/b/c/test, build/a/d/whatever, and everything inside them, your preferences profile should include:

ignore = Path build/*
ignorenot = Path build/a
ignore = Path build/a/*
ignorenot = Path build/a/b
ignorenot = Path build/a/d
ignore = Path build/a/b/*
ignore = Path build/a/d/*
ignorenot = Path build/a/b/c
ignorenot = Path build/a/d/whatever
ignore = Path build/a/b/c/*
ignorenot = Path build/a/b/c/test

This way Unison will ignore everything in the build folder, except for build/a/d/whatever and build/a/b/c/test

zasjls
  • 46
  • 3
  • Thx for the explanation (that should be in the docs!). So the short answer is "no". I decided to just decide explicitly include the files that I need in the .prf file, and change them as I work. I thought a single setup of my .prf file would do it, but I just change it when I change from project to project, doesn't take that much time. – akevan May 29 '20 at 19:29