Yet another filter question

Christoph Biedl cbiedl at gmx.de
Sat May 7 22:14:22 UTC 2016


Wayne Davison wrote...

> On Tue, May 3, 2016 at 1:07 PM, Christoph Biedl <cbiedl at gmx.de> wrote:
> 
> >   + *.git/.git/*
> >   - *.git/
> >
> 
> >From the man page near the start of the "INCLUDE/EXCLUDE PATTERN RULES"
> section:
> 
> *Note that, when using the --recursive (-r) option (which is implied by
> > -a), every subcomponent of every path is visited from the top down, so
> > include/exclude patterns get applied recursively to each subcomponent’s
> > full name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and
> > "/foo/bar" must not be excluded). The exclude patterns actually
> > short-circuit the directory traversal stage when rsync finds the files to
> > send.*

Yeah, things like this are the reason why I got the impression rsync's
filter behaviour is acting strange. It certainly makes perfect sense
once you've understood in great detail how it works - until then you're
just confused.

> Thus, your latter exclude prevents the first include from ever seeing any
> data that it could match. You'd need to use something more like this:
> 
> + *.git/.git/
> - *.git/*

No, that one kills files inside *.git/.git/, too.

Kevin's suggestion however does the trick. Thanks!

Another working solution:

+ /*.git/.git/
- /*.git/*

    Christoph



More information about the rsync mailing list