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.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
log --grep/--author: honor --all-match honored for multiple --grep patterns

Earlier, when we have both header expression (which has to be an OR
node by construction) and a pattern expression (which could be
anything), we created a top-level OR node that looks like this to
bind them together:

             OR
        /          \
       /            \
   pattern            OR
     / \           /     \
    .....    committer    OR
                         /   \
                     author   TRUE

In other words, the three elements on the top-level backbone that
were inspected by the "all-match" logic are "pattern", "committer"
and "author".  When there are more than one elements in the
"pattern", the top-level node of it is that OR, so that node is
inspected by "all-match", hence the result ends up ignoring the
"--all-match" given from the command line.  A match on either side
of the pattern was considered a match, hence

        git log --grep=A --grep=B --author=C --all-match

showed the same "authored by C and has either A or B" with or
without --all-match.

This patch turns the grep expression into this form:

              OR
          /       \
         /          \
        /              OR
    committer        /    \
                 author    \
                           pattern

when "--all-match" was given from the command line.  This way, the
set of nodes on the top-level backbone in the resulting expression
consists of "committer", "author", and whatever nodes were on the
top-level backbone of the "pattern" expression.  The "all-match"
logic inspects the same nodes in "pattern" as the case without the
author and/or the committer restriction.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
log: document use of multiple commit limiting options

Generally speaking, using more options will further narrow the
selection, but there are a few exceptions.  Document them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'rj/tap-fix' into jch

Will merge to 'master' as part of the sixth batch.

* rj/tap-fix:
  test-lib.sh: Suppress the "passed all ..." message if no tests run
  test-lib.sh: Add check for invalid use of 'skip_all' facility
  test-lib.sh: Fix some shell coding style violations
  t4016-*.sh: Skip all tests rather than each test
  t3902-*.sh: Skip all tests rather than each test
  t3300-*.sh: Fix a TAP parse error
Merge branch 'nd/i18n-status' into jch

Will merge to 'master' as part of the sixth batch.

* nd/i18n-status:
  status: remove i18n legos
Merge branch 'sn/ls-remote-get-url-doc' into jch

Will merge to 'master' as part of the sixth batch.

* sn/ls-remote-get-url-doc:
  ls-remote: document the '--get-url' option
Merge branch 'dj/fetch-all-tags' into jch

"git fetch --all", when passed "--no-tags", did not honor the
"--no-tags" option while fetching from individual remotes (the same
issue existed with "--tags", but combination "--all --tags" makes
much less sense than "--all --no-tags").

Will merge to 'master' as part of the sixth batch.

* dj/fetch-all-tags:
  fetch --all: pass --tags/--no-tags through to each remote
Merge branch 'rj/path-cleanup' into jch

Will merge to 'master' as part of the sixth batch.

* rj/path-cleanup:
  Call mkpathdup() rather than xstrdup(mkpath(...))
  Call git_pathdup() rather than xstrdup(git_path("..."))
  path.c: Use vsnpath() in the implementation of git_path()
  path.c: Don't discard the return value of vsnpath()
  path.c: Remove the 'git_' prefix from a file scope function
Merge branch 'rs/archive-zip-utf8' into jch

Need help from people on platforms on which Zip matters to see
compatiblity with other people's zip implementations.

Will merge to 'master' as part of the sixth batch.

* rs/archive-zip-utf8:
  archive-zip: support UTF-8 paths
Merge branch 'mh/abspath' into jch

Will merge to 'master' as part of the sixth batch.

* mh/abspath:
  t0060: split absolute path test in two to exercise some of it on Windows
  t0060: verify that real_path() removes extra slashes
  real_path(): properly handle nonexistent top-level paths
  t0060: verify that real_path() works correctly with absolute paths
  real_path(): reject the empty string
  t0060: verify that real_path() fails if passed the empty string
  absolute_path(): reject the empty string
  t0060: verify that absolute_path() fails if passed the empty string
  t0060: move tests of real_path() from t0000 to here
Merge branch 'nd/checkout-option-parsing-fix' into jch

The option parsing of "git checkout" had error checking, dwim and
defaulting missing options, all mixed in the code, and issuing an
appropriate error message with useful context was getting harder.
Reorganize the code and allow giving a proper diagnosis when the
user says "git checkout -b -t foo bar" (e.g. "-t" is not a good name
for a branch).

Will merge to 'master' as part of the sixth batch.

* nd/checkout-option-parsing-fix:
  checkout: reorder option handling
  checkout: move more parameters to struct checkout_opts
  checkout: pass "struct checkout_opts *" as const pointer

Conflicts:
	builtin/checkout.c
Merge branch 'jc/mailinfo-RE' into jch

We strip the prefix from "Re: subject" and also from a less common
"re: subject", but left even less common "RE: subject" intact.

Will merge to 'master' as part of the seventh batch.

* jc/mailinfo-RE:
  mailinfo: strip "RE: " prefix
Merge branch 'dg/run-command-child-cleanup' into jch

The code to wait for subprocess and remove it from our internal queue
wasn't quite right.

Will merge to 'master' as part of the seventh batch.

* dg/run-command-child-cleanup:
  run-command.c: fix broken list iteration in clear_child_for_cleanup
Merge branch 'cn/branch-set-upstream-to' into jch

Finishing touches to the recently graduated topic to introduce
"git branch --set-upstream-to" option.

Will merge to 'master' as part of the seventh batch.

* cn/branch-set-upstream-to:
  completion: complete branch name for "branch --set-upstream-to="
  completion: add --set-upstream-to and --unset-upstream
Merge branch 'jc/ll-merge-binary-ours' into jch

"git merge -Xtheirs" did not help content-level merge of binary
files; it should just take their version.  Also "*.jpg binary" in
the attributes did not imply they should use the binary ll-merge
driver.

Will merge to 'master' as part of the seventh batch.

* jc/ll-merge-binary-ours:
  ll-merge: warn about inability to merge binary files only when we can't
  attr: "binary" attribute should choose built-in "binary" merge driver
  merge: teach -Xours/-Xtheirs to binary ll-merge driver

Conflicts:
	ll-merge.c
Merge branch 'sl/autoconf' into jch

Reduces repetition in configure.ac.

Will merge to 'master' as part of the seventh batch.

* sl/autoconf:
  build: don't duplicate substitution of make variables
  build: improve GIT_CONF_SUBST signature
Merge branch 'jc/maint-blame-no-such-path' into jch

"git blame MAKEFILE" run in a history that has "Makefile" but not
"MAKEFILE" should say "No such file MAKEFILE in HEAD", but got
confused on a case insensitive filesystem and failed to do so.

Even during a conflicted merge, "git blame $path" always meant to
blame uncommitted changes to the "working tree" version; make it
more useful by showing cleanly merged parts as coming from the other
branch that is being merged.

Will merge to 'next'.

* jc/maint-blame-no-such-path:
  blame: allow "blame file" in the middle of a conflicted merge
  blame $path: avoid getting fooled by case insensitive filesystems
Merge branch 'mh/string-list' into jch

Will merge to 'next'.

* mh/string-list:
  api-string-list.txt: initialize the string_list the easy way
  string_list: add a function string_list_longest_prefix()
  string_list: add a new function, string_list_remove_duplicates()
  string_list: add a new function, filter_string_list()
  string_list: add two new functions for splitting strings
  string_list: add function string_list_append_nodup()
Merge branch 'mh/fetch-filter-refs' into jch

Code simplification and clarification.

Will merge to 'next'.

* mh/fetch-filter-refs:
  fetch-pack: eliminate spurious error messages
  cmd_fetch_pack(): simplify computation of return value
  fetch-pack: report missing refs even if no existing refs were received
  cmd_fetch_pack(): return early if finish_connect() fails
  filter_refs(): simplify logic
  filter_refs(): build refs list as we go
  filter_refs(): delete matched refs from sought list
  fetch_pack(): update sought->nr to reflect number of unique entries
  filter_refs(): do not check the same sought_pos twice
  Change fetch_pack() and friends to take string_list arguments
  fetch_pack(): reindent function decl and defn
  Rename static function fetch_pack() to http_fetch_pack()
  t5500: add tests of fetch-pack --all --depth=N $URL $REF
  t5500: add tests of error output for missing refs
Merge branch 'jk/no-more-pre-exec-callback' into pu

(Originally merged to 'next' on 2012-07-23)

Will defer until the end of the 2012.
while waiting for older "less" to go extinct.

* jk/no-more-pre-exec-callback:
  pager: drop "wait for output to run less" hack