git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Rene Pasing <rene@pasing.net>
Cc: git@vger.kernel.org
Subject: Re: Wrong gitattributes documentation?
Date: Sat, 03 Jun 2017 09:01:09 +0900	[thread overview]
Message-ID: <xmqq8tlax7lm.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <e7734a23-12b2-8f62-ab5c-c856d59e3010@pasing.net> (Rene Pasing's message of "Fri, 2 Jun 2017 19:12:36 +0200")

Rene Pasing <rene@pasing.net> writes:

> The problem is, the documentation[1] says: "The rules how the pattern
> matches paths are the same as in .gitignore files; see gitignore[5].",
> so when I have a pattern like '/images/', it should match on all
> files+folders under /images, even the directory itself, right?
>
> Or when
> I'd use '/images/*', it should match on all files+folders under
> /images, right?

My reading of "PATTERN FORMAT" section in "git help ignore" says it
shouldn't.

 - 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).

 - Otherwise, Git treats the pattern as a shell glob suitable
   for consumption by fnmatch(3) with the FNM_PATHNAME flag:
   wildcards in the pattern will not match a / in the pathname.
   For example, "Documentation/{asterisk}.html" matches
   "Documentation/git.html" but not "Documentation/ppc/ppc.html"
   or "tools/perf/Documentation/perf.html".

Your "/images/*" is the "Otherwise" case, isn't it?

  reply	other threads:[~2017-06-03  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 17:12 Wrong gitattributes documentation? Rene Pasing
2017-06-03  0:01 ` Junio C Hamano [this message]
2017-06-03  1:10   ` Rene Pasing
2017-06-03  1:20   ` Rene Pasing

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq8tlax7lm.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rene@pasing.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).