git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Clemens Buchacher <drizzd@aon.at>
Cc: git@vger.kernel.org, johannes@familieschneider.info
Subject: Re: [PATCH 3/3] implement pattern matching in ce_path_match
Date: Thu, 15 Jan 2009 18:51:07 -0800	[thread overview]
Message-ID: <7vzlhsneuc.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vljtd20m6.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Wed, 14 Jan 2009 10:39:29 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> Clemens Buchacher <drizzd@aon.at> writes:
>
>> With this patch ce_path_match uses match_pathspec in order to perform
>> pattern matching.
>
> We have two conflicting definitions of pattern matching in our system.
> I'd make it more explicit which kind of pattern matching you are talking
> about here.
>
> The family of operations based on the diff-tree machinery (e.g. path
> limited revision walking "git log A..B -- dir1/dir2") define the pattern
> matching as "leading path match (exact match is just a special case of
> this)".  Other operations that work on paths in the work tree and the
> index (e.g. grep, ls-files) uses "leading path match, but fall back to
> globbing".
>
> In the longer term we really should unify them by teaching the former to
> fall back to globbing without getting undue performance hit, and this
> patch may be a step in the right direction.  There are optimizations that
> assume the "leading path" semantics to trim the input early and avoid
> opening and descending into a tree object if pathspec patterns cannot
> possibly match (see tree-diff.c::tree_entry_interesting() for an example),
> and we need to teach them to notice a glob wildcard in an earlier part of
> a pathspec and to descend into some trees that they would have skipped
> with the old definition of pathspec.

Actually there was an earlier attempt that resulted in the pathspec
matching tree traverser builtin-grep uses.  Even though it has to work
with trees (when grepping inside a tree-ish) and has optimizations not to
open unnecessary subtrees similar to the one the diff-tree machinery has,
it also knows how to handle globs.  If we were to pick one of existing
implementations for the longer term unification, I think that is probably
the one we should build on top of.

  parent reply	other threads:[~2009-01-16  2:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 14:54 [PATCH 0/3] fix "git add" pattern matching Clemens Buchacher
2009-01-14 14:54 ` [PATCH 1/3] clean up pathspec matching Clemens Buchacher
2009-01-14 14:54   ` [PATCH 2/3] remove pathspec_match, use match_pathspec instead Clemens Buchacher
2009-01-14 14:54     ` [PATCH 3/3] implement pattern matching in ce_path_match Clemens Buchacher
2009-01-14 15:25       ` Clemens Buchacher
2009-01-14 15:44       ` Johannes Schindelin
2009-01-14 15:55         ` Sverre Rabbelier
2009-01-14 16:18         ` Samuel Tardieu
2009-01-14 16:53           ` Jeff King
2009-01-14 18:39       ` Junio C Hamano
2009-01-14 19:23         ` Clemens Buchacher
2009-01-14 22:27           ` Junio C Hamano
2009-01-15  8:20             ` Clemens Buchacher
2009-01-16  2:51         ` Junio C Hamano [this message]
2009-01-14 15:40     ` [PATCH 2/3] remove pathspec_match, use match_pathspec instead Johannes Schindelin
2009-01-14 16:09       ` Clemens Buchacher

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=7vzlhsneuc.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=johannes@familieschneider.info \
    /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.
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 NNTP newsgroup(s).