diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-09-12 22:15:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-09-13 01:11:55 -0700 |
commit | 5aaeb733f5745b37878901c4687ba67c6a70e581 (patch) | |
tree | 073bd6553e10f0c654a3e15e18c9c5bd52e055c5 /grep.h | |
parent | 95ce9ce296e1636a2b78e73b96905d781ef2ddc7 (diff) | |
download | git-5aaeb733f5745b37878901c4687ba67c6a70e581.tar.gz |
log --author: take union of multiple "author" requests
In the olden days,
log --author=me --committer=him --grep=this --grep=that
used to be turned into:
(OR (HEADER-AUTHOR me)
(HEADER-COMMITTER him)
(PATTERN this)
(PATTERN that))
showing my patches that do not have any "this" nor "that", which was
totally useless.
80235ba ("log --author=me --grep=it" should find intersection, not union,
2010-01-17) improved it greatly to turn the same into:
(ALL-MATCH
(HEADER-AUTHOR me)
(HEADER-COMMITTER him)
(OR (PATTERN this) (PATTERN that)))
That is, "show only patches by me and committed by him, that have either
this or that", which is a lot more natural thing to ask.
We however need to be a bit more clever when the user asks more than one
"author" (or "committer"); because a commit has only one author (and one
committer), they ought to be interpreted as asking for union to be useful.
The current implementation simply added another author/committer pattern
at the same top-level for ALL-MATCH to insist on matching all, finding
nothing.
Turn
log --author=me --author=her \
--committer=him --committer=you \
--grep=this --grep=that
into
(ALL-MATCH
(OR (HEADER-AUTHOR me) (HEADER-AUTHOR her))
(OR (HEADER-COMMITTER him) (HEADER-COMMITTER you))
(OR (PATTERN this) (PATTERN that)))
instead.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.h')
-rw-r--r-- | grep.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -22,6 +22,7 @@ enum grep_header_field { GREP_HEADER_AUTHOR = 0, GREP_HEADER_COMMITTER }; +#define GREP_HEADER_FIELD_MAX (GREP_HEADER_COMMITTER + 1) struct grep_pat { struct grep_pat *next; @@ -41,6 +42,7 @@ enum grep_expr_node { GREP_NODE_ATOM, GREP_NODE_NOT, GREP_NODE_AND, + GREP_NODE_TRUE, GREP_NODE_OR }; |