Turning the ignore patterns into a whitelist?

Is it possible to specify a list of a few directories/sub-directories to keep intact rather than specifying a list of directories to ignore?

1 Like

Yes;

!/sync/this
!/and/this
*

This is a completely side question, but I’ve always been curious. The final effect is the same, but is it more efficient to put * or / in the last line? Or is there no difference at all when parsing it?

I’m actually also curious about what @tomasz86 said, in addition to whether or not the order of things matters and if I could place the * or / first.

* (or /) has to go last.

Looking at how the patterns are parsed, the end result for / is simpler than for * so the slash could be slightly more efficient. There’s no reason for that, we could simply optimise one to the other, if the difference was relevant or even measurable (which I doubt it is). The asterisk feels more obvious as “everything” to me, though.

2 Likes

Thanks for the explanation! I understand that this is just a micro-optimisation but still :sweat_smile:.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.