Marco Costalba <[EMAIL PROTECTED]> writes:

> Peraphs, if the file name of excluded list is the same for each directory, 
> e.g. .gitignore or something similar, instead of --exclude-per-directory
> we can use a concept of file validity 'scope' and just use 
> --exclude-from=<file>.
> If entering in a directory <file> is found its contents are appended and 
> removed when leaving directory. A bad analogy can be with the use of 
> recursive Makefile.

I do not know if you noticed it, but the patch already have the
concept of "scope".  If a pattern has a slash '/' it is scoped
to the named directory by using FNM_PATHNAME.  "The named
directory" for command line --exclude and --exclude-from are
relative to the project top while it is relative to the
directory the file being used is in for --exclude-per-directory
case.

> If we use the 'scope' logic we can just prepend path when adding entries
> and serach with with FNM_PATHNAME flag.

You suggest to always use FNM_PATHNAME by adjusting the pattern
by prefixing the scope.  While that can theoretically be made to
work just as the posted patch does, you need to realize it is a
lot more cumbersome to deal with metacharacters in pathnames
your way.  If the prefix you need to add (because you are now
looking at a path for that directory which has a funny name) is
"foo*bar", you need to add "foo\*bar" to the pattern in order to
make sure that the asterisk is not used to match anything other
than a literal asterisk, for example.

You could argue that nobody should use funny characters in
pathnames, and you could further argue that current Porcelains
do not handle certain characters in pathnames anyway so why
bother.  But ls-files being core, which is "the funny filesystem
layer to build SCM on", I would like to be careful not to be
unnecessarily restrictive.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to