Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:32

Emil Sit [off-list ref] 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).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help