Subject: Re: [PATCH 5/6] gitignore: do not do basename match with patterns that have '**'

From: Johannes Sixt <[email-masked]>
Date: Fri, 05 Oct 2012 09:01:19 +0200

Am 10/4/2012 9:39, schrieb Nguyễn Thái Ngọc Duy:
> - - If the pattern does not contain a slash '/', git treats it as
> -   a shell glob pattern and checks for a match against the
> -   pathname relative to the location of the `.gitignore` file
> -   (relative to the toplevel of the work tree if not from a
> -   `.gitignore` file).
> + - If the pattern does not contain a slash '/' nor '**', git
> +   treats it as a shell glob pattern and checks for a match
> +   against the pathname relative to the location of the
> +   `.gitignore` file (relative to the toplevel of the work tree
> +   if not from a `.gitignore` file).

> +test_expect_success '"**" with no slashes test' '
> +	echo "a**f foo=bar" >.gitattributes &&
> +	cat <<\EOF >expect &&
> +f: foo: unspecified
> +a/f: foo: bar
> +a/b/f: foo: bar
> +a/b/c/f: foo: bar
> +EOF

Should the above .gitattributes match nested paths, such as b/a/c/f?

I think it should, because the user can easily say "/a**f" that nested
paths should not be matched.

But if it does not match, as your documentation update implies, which
options does the user have to match nested paths? Only to add more
patterns for each nested directory, such as "b/a**f".

-- Hannes