3

使用版本 2.51.2 (ocaml 4.04.0)。

尝试排除根目录下的文件夹(称为 build),但在其下方的任何深度包含任何以 .err 和 .out 结尾的文件。

结构看起来像

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

我试过了

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

...这会产生“格式错误的模式”错误。还尝试使用此显式同步整个子目录:

ignorenot = Path a/b/c/test/

但是“测试”文件夹仍然不同步。

如何让所有 .err/.out 文件同步,而忽略其他所有内容?

4

1 回答 1

2

Unison 的“ignorenot”偏好有点违反直觉

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

如果一个目录被忽略,它的所有后代也将被忽略,该树下的所有内容都将被忽略并且不再检查。

Ignorenot 仅在同一级别阻止忽略,因此您必须覆盖所有树,直到要应用的 ignorenot,并使用一对 ignore 和 ignorenot。例如,在您上面引用的情况下,如果您想忽略 build 中的所有内容,除了 build/a/b/c/test、build/a/d/whatever以及其中的所有内容,您的偏好配置文件应包括:

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

这样,Unison 将忽略 build 文件夹中的所有内容,除了 build/a/d/whatever 和 build/a/b/c/test

于 2020-05-26T08:02:26.527 回答