git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] log --author: take union of multiple "author" requests

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 13, 2010, 18:11 UTC
Message-ID
<7vfwxdbjj7.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTinaj4AsPE9j-gS2-0Cn8jx7a1uYYGtmq5oC=YVB@mail.gmail.com>
Emil Sit <sit@emilsit.net> writes:
> I'm a little confused about the implementation with regards to
> --all-match; does there still need to be an all-match flag?

When used in the context of "git log --grep/--author/--committer" (as opposed to more flexible "git grep"), in conjunction with either of the "header match" element (--author/committer), all-match is implied.

The implementation of the all-match rewriting gets a bit trickier than necessary, as our internal representation of nodes does not have n-ary ALL-MATCH (nor n-ary OR/AND) node.

An (ALL-MATCH 1 2 3 4) node is instead represented by this grep_expr binary tree (rooted at the leftmost OR node):

      OR--OR--OR--4
      |   |   |
      1   2   3

and requiring the top-level terms of backbone OR chain (i.e. 1 2 3 4) to all match.

In order to represent
    (ALL-MATCH
     (PATTERN this)
     (OR (AUTHOR A) (AUTHOR B)))
we cannot simply do
     OR--------------OR-----------author B
     |               |
     pattern "this"  author A

because this requires both (AUTHOR A) and (AUTHOR B) to match, in addition to "this". We instead need to do something like:

     OR--------------OR---TRUE
     |               |
     pattern "this"  OR---author B
                     |
                     author A

to say "this" must match and (OR (author A) (author B)) must match (IOW the terms on the backbone OR chain are (PATTERN this), (OR (AUTHOR A/B)) and TRUE and they all have to match).

Previous: Emil Sit
Message 6 of 6 in “Regression in git log with multiple authors”
  1. Emil SitAug 26, 2010
  2. Junio C HamanoAug 26, 2010
  3. 1/2 grep: move logic to compile header pattern into a separate helperJunio C Hamano, Sep 13, 2010
  4. 2/2 log --author: take union of multiple "author" requestsJunio C Hamano, Sep 13, 2010
  5. Emil SitSep 13, 2010
  6. Junio C HamanoSep 13, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.