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 3and 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 Abecause 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 Ato 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).