git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Sérgio Peixoto" <sergio.peixoto@gmail.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Brandon Williams" <bwilliams.eng@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] attr: do not mark queried macros as unset
Date: Tue, 22 Jan 2019 14:00:03 -0800	[thread overview]
Message-ID: <xmqqef94e4kc.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190118214626.GC28808@sigill.intra.peff.net> (Jeff King's message of "Fri, 18 Jan 2019 16:46:27 -0500")

Jeff King <peff@peff.net> writes:

> And here's a resurrection of the optimization that _seems_ to work, but
> I'm not 100% confident in.
>
> In particular, it does not care about macros at all. It simply asks: is
> this queried attribute a thing which was ever mentioned in the
> attributes files (either as a path match or as a possible macro
> expansion). If not, then we know we do not need to look further for it.

So, if we are looking for 'diff' and we know no .gitattributes (or
$GIT_DIR/info/attributes) entry for 'diff' or any macro that expands
to touch 'diff' (e.g. 'binary') is in use, we know for any path
governed by the current attr-stack 'diff' attribute is unspecified.
But if we see an entry, say, "*.exe binary", then we do need to be
aware of the possibility that 'diff' may be unset for some paths.

Makes sense.

> I guess maybe what I'm missing is that asking for "diff" means that we
> need to care about:
>
>   - whether "diff" was mentioned in the stack
>
>   - whether "binary" was mentioned in the stack
>
> But just "binary" mentioning "diff" is not interesting without somebody
> actually mentioning "binary".

Yeah, that matches my understanding (which mostly comes from the
original design before even Duy's optimization).

> I'm not sure how to do it robustly without being able to reverse-map all
> of the macros after we've resolved them (i.e., to know that "diff" gets
> mentioned by "binary", and then check if "binary" is actually
> mentioned). I think that would be possible now, as we should know that
> after determine_macros(). But I also wonder if we are hitting
> diminishing returns (after all, determine_macros() is already walking
> the attr stack).

  parent reply	other threads:[~2019-01-22 22:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 15:47 Change on check-attr behavior Sérgio Peixoto
2019-01-17 16:07 ` Jeff King
2019-01-18  9:41   ` Sérgio Peixoto
2019-01-18 16:58     ` Jeff King
2019-01-18 21:34       ` [PATCH] attr: do not mark queried macros as unset Jeff King
2019-01-18 21:46         ` Jeff King
2019-01-18 22:19           ` Stefan Beller
2019-01-22  7:19             ` Jeff King
2019-01-22  9:50               ` Duy Nguyen
2019-01-22 22:00           ` Junio C Hamano [this message]
2019-01-21 10:05         ` Duy Nguyen
2019-01-22  7:21           ` Jeff King
2019-01-22  9:34         ` Duy Nguyen
2019-01-22 21:48         ` Junio C Hamano
2019-01-23  5:40           ` Jeff King

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=xmqqef94e4kc.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=bwilliams.eng@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sergio.peixoto@gmail.com \
    /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).