From: Duy Nguyen <pclouds@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>, Jeff King <peff@peff.net>,
bmwill@fb.com
Subject: Re: [PATCH 0/5] Make :(attr) pathspec work with "git log"
Date: Mon, 19 Nov 2018 16:31:17 +0100 [thread overview]
Message-ID: <CACsJy8B=-7Z6qP6UwoKnQSugxDi8o1t2aKXHWzf_ST0Qo5kezA@mail.gmail.com> (raw)
In-Reply-To: <877eh91egn.fsf@evledraar.gmail.com>
On Mon, Nov 19, 2018 at 12:42 PM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
>
> On Sun, Nov 18 2018, Nguyễn Thái Ngọc Duy wrote:
>
> > When :(attr) was added, it supported one of the two main pathspec
> > matching functions, the one that works on a list of paths. The other
> > one works on a tree, tree_entry_interesting(), which gets :(attr)
> > support in this series.
> >
> > With this, "git grep <pattern> <tree> -- :(attr)" or "git log :(attr)"
> > will not abort with BUG() anymore.
> >
> > But this also reveals an interesting thing: even though we walk on a
> > tree, we check attributes from _worktree_ (and optionally fall back to
> > the index). This is how attributes are implemented since forever. I
> > think this is not a big deal if we communicate clearly with the user.
> > But otherwise, this series can be scraped, as reading attributes from
> > a specific tree could be a lot of work.
> >
> > The main patch is the last one. The others are just to open a path to
> > pass "struct index_state *" down to tree_entry_interesting(). This may
> > become standard procedure because we don't want to stick the_index (or
> > the_repository) here and there.
>
> Another side-note (this thread is turning into my personal blog at this
> point...) I found an old related thread:
> https://public-inbox.org/git/20170509225219.GB106700@google.com/
>
> So this series fixes 1/2 of the issues noted there, but git-ls-tree will
> still die with the same error.
If you mean BUG(), not it does not. There are just a couple more
places besides tree_entry_interesting() and match_pathspec() that need
to be aware of all the magic things. ls-tree is one of those but it's
well guarded and will display this instead
$ git ls-tree HEAD ':(attr:abc=def)'
fatal: :(attr:abc=def): pathspec magic not supported by this command: 'attr'
If you mean making ls-tree support :(attr) and other stuff, it's not
going to happen in near future. It may be nice to switch to
tree_entry_interesting() in this command, but if it was easy to do I
would have done it years ago :P
--
Duy
prev parent reply other threads:[~2018-11-19 15:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-18 16:47 [PATCH 0/5] Make :(attr) pathspec work with "git log" Nguyễn Thái Ngọc Duy
2018-11-18 16:47 ` [PATCH 1/5] tree.c: make read_tree*() take 'struct repository *' Nguyễn Thái Ngọc Duy
2018-11-18 16:47 ` [PATCH 2/5] tree-walk.c: make tree_entry_interesting() take an index Nguyễn Thái Ngọc Duy
2018-11-18 16:47 ` [PATCH 3/5] pathspec.h: clean up "extern" in function declarations Nguyễn Thái Ngọc Duy
2018-11-18 16:47 ` [PATCH 4/5] dir.c: move, rename and export match_attrs() Nguyễn Thái Ngọc Duy
2018-11-18 16:48 ` [PATCH 5/5] tree-walk: support :(attr) matching Nguyễn Thái Ngọc Duy
2018-11-18 19:58 ` Ævar Arnfjörð Bjarmason
2018-11-19 15:33 ` Duy Nguyen
2018-11-18 19:51 ` [PATCH 0/5] Make :(attr) pathspec work with "git log" Ævar Arnfjörð Bjarmason
2018-11-19 11:16 ` Ævar Arnfjörð Bjarmason
2018-11-19 15:25 ` Duy Nguyen
2018-11-19 12:09 ` Jeff King
2018-11-19 1:49 ` Junio C Hamano
2018-11-19 11:42 ` Ævar Arnfjörð Bjarmason
2018-11-19 15:31 ` Duy Nguyen [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
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='CACsJy8B=-7Z6qP6UwoKnQSugxDi8o1t2aKXHWzf_ST0Qo5kezA@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=bmwill@fb.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.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).