From: "Marcin Wiśnicki" <mwisnicki@gmail•com>
To: git@vger•kernel.org
Subject: Re: [PATCH] gitattributes.txt: mention exceptions to gitignore rules
Date: Tue, 4 Jan 2011 21:17:26 +0000 (UTC) [thread overview]
Message-ID: <ig02p5$kh3$1@dough.gmane.org> (raw)
In-Reply-To: 7vwrmkfphh.fsf@alter.siamese.dyndns.org
On Tue, 04 Jan 2011 11:17:14 -0800, Junio C Hamano wrote:
>> Patterns that do not match but should:
>> d2/*
>
> This shouldn't match unless it appears in d1/.gitattributes.
>
> The presense of '/' makes the pattern anchored to the directory it
> appear in, and .git/info/attributes is taken as being at the top level.
>
After more carefully re-reading gitignore(5) I think that now I get it.
I presume that is is not possible to match certain pattern occurring
*anywhere* in the path.
Would it be possible to extend pattern format to include double-star
wildcard that matches anything including slashes ?
Like: **/whatever/**
Many tools (in java at least) and libraries support such extension to
globs. Unfortunately standard fnmatch(3) that's used by git is not one of
them, but glibc's implementation looks portable and self-contained so it
could be included and modified.
>> d2/
>> d2
>
> These shouldn't for the same reason.
>
>> d1/d2
>> /d1/d2
>
> We somehow don't do leading path match like we do for gitignore, but I
> do not think this was intended. My gut feeling is that these should
> match.
>
> The thinking back, when we wrote the code, could have been that, unlike
> gitignore that maintains only one bit (either "ignored" or "not"),
> attributes are richer and giving the same attribute (say "whitespace
> checking criteria") to files inside a directory and the containing
> directory itself was nonsensical. But if that was the reason, it is
> faulty, as we do not track directories anyway.
>
> Wouldn't it be sufficient to teach attr.c:path_matches() that a pattern
> could also match with leading path? That would automatically cover the
> case where a pattern is terminated with a slash, as pattern "d/e/" would
> never match path "d/e" but does match "d/e/f"?
prev parent reply other threads:[~2011-01-04 21:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <iftvu6@dough.gmane.org>
2011-01-04 13:31 ` [PATCH] gitattributes.txt: mention exceptions to gitignore rules Nguyễn Thái Ngọc Duy
2011-01-04 14:50 ` Michael J Gruber
2011-01-04 15:40 ` Marcin Wiśnicki
2011-01-04 19:17 ` Junio C Hamano
2011-01-04 21:17 ` Marcin Wiśnicki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='ig02p5$kh3$1@dough.gmane.org' \
--to=mwisnicki@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox