Re: [PATCH] config: add conditional include

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 27, 2016 at 06:14:17PM +0200, Duy Nguyen wrote:

> >> +             } else if (!strchr(pattern.buf, '/')) {
> >> +                     /* no slashes match one directory component */
> >> +                     strbuf_insert(&pattern, 0, "**/", 3);
> >> +                     strbuf_addstr(&pattern, "/**");
> >> +             }
> >
> > I guess it's a little funny that "foo" and "foo/bar" are matched quite
> > differently. I wonder if a simpler rule would just be: relative paths
> > are unanchored.
> 
> I modeled it after .gitignore patterns, but that's probably not a good
> fit here. Making all relative paths un-anchored means I can't say
> "paths that end with this suffix". How useful that statement is, I
> can't say though. Or if you mean only prepend "**/" to relative paths,
> not "/**" then that door is still open.

I didn't really mean anything, as I had not thought about it that
carefully. :)

You do allow distinguishing the suffix thing with "/" at the end in the
rule above, though. So between the two rules:

  - slash at the end is a shorthand for "/**"

  - no-slash at the beginning (i.e., a non-absolute path) is a shorthand
    for "**/" at the beginning

you should be able to specify anything.

I do agree that there's value in trying to make the rules consistent
with other parts of git, though. I don't know the corner cases of
gitignore and gitattributes well enough to compare off the top of my
head, though (though I suspect you do. :) ).

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]