Junio C Hamano venit, vidit, dixit 13.09.2012 23:21: > Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> writes: > >> Thanks for "this" ;) > > Here is a replacement to "this", that adds the "--debug" option to > "git grep" and an equivalent "--debug-grep" to "git log" family. > > -- >8 -- > Subject: [PATCH] grep: teach --debug option to dump the parse tree > > Our "grep" allows complex boolean expressions to be formed to match > each individual line with operators like --and, '(', ')' and --not. > Introduce the "--debug" option to show the parse tree to help people > who want to debug and enhance it. > > Also "log" learns "--debug-grep" option to do the same. The command > line parser to the log family is a lot more limited than the general > "git grep" parser, but it has special handling for header matching > (e.g. "--author"), and a parse tree is valuable when working on it. > > Note that "--all-match" is *not* any individual node in the parse > tree. It is an instruction to the evaluator to check all the nodes > in the top-level backbone have matched and reject a document as > non-matching otherwise. I haven't read all your responses yet, but the/my main confusion comes from all-match. My understanding is: --all-match == turn all top-level ORs into ANDs (unless it's all --author at the top-level; and I'm referring to user supplied ORs, not those added by the implementation) Seing (OR foo true) being evaluated to false when foo is false and all-match is in effect is terribly confusing, me thinks (debug output). In fact, I think the behavior described above (if it's correct) is a product of the evolution of grep.c and the current implementation (turning former unions into intersections in some cases, inserting that TRUE node), but not necessarily the intended or preferrable outcome in all corner cases. We AND different types of limit options in any case (this used to be affected by --all-match[?]), and we OR --author options in any case. So having --all-match turn "--grep=foo --grep=bar" from OR into AND would make the most sense at least to me (and I mean: independent of the presence of an --author option). Michael -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html