Thread (10 messages) flat view 10 messages, 3 authors, 2016-06-15

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

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:54:57

Possibly related (same subject, not in this thread)

On Fri, Oct 5, 2012 at 2:01 PM, Johannes Sixt [off-list ref] wrote:
Am 10/4/2012 9:39, schrieb Nguyễn Thái Ngọc Duy:
quoted
- - 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).
I think in the latest round, we forbid this case (i.e. a/**, **/b and
a/**/b are ok, but a**b is not), exactly because it's hard to define
how it should do. Thanks for another example.
quoted
+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.
The user can also say **/a/**f to match b/a/c/f.
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help