fast-import: document the --done option

Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cherry-pick: don't forget -s on failure

In case 'git cherry-pick -s <commit>' failed, the user had to use 'git
commit -s' (i.e. state the -s option again), which is easy to forget
about.  Instead, write the signed-off-by line early, so plain 'git
commit' will have the same result.

Also update 'git commit -s', so that in case there is already a relevant
Signed-off-by line before the Conflicts: line, it won't add one more at
the end of the message. If there is no such line, then add it before the
the Conflicts: line.

Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 "--grep-debug" 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>
grep: show --debug output only once

When threaded grep is in effect, the patterns are duplicated and
recompiled for each thread. Avoid "--debug" output during the
recompilation so that the output is given once instead of "1+nthreads"
times.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
log --grep/--author: honor --all-match honored for multiple --grep patterns

When we have both header expression (which has to be an OR node by
construction) and a pattern expression (which could be anything), we
create a new top-level OR node to bind them together, and the
resulting expression structure looks like this:

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

The three elements on the top-level backbone that are 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 the "pattern" part of the subtree is an OR, and that node is
inspected by "all-match".

The result ends up ignoring the "--all-match" given from the command
line.  A match on either side of the pattern is considered a match,
hence:

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

shows the same "authored by C and has either A or B" that is correct
only when run without "--all-match".

Fix this by turning the resulting expression around when "--all-match"
is in effect, like this:

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

The set of nodes on the top-level backbone in the resulting
expression becomes "committer", "author", and the nodes that are on
the top-level backbone of the "pattern" subexpression.  This makes
the "all-match" logic inspect the same nodes in "pattern" as the
case without the author and/or the committer restriction, and makes
the earlier "log" example to show "authored by C and has A and has
B", which is what the command line expects.

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>
fetch: align per-ref summary report in UTF-8 locales

fetch does printf("%-*s", width, "foo") where "foo" can be a utf-8
string, but width is in bytes, not columns. For ASCII it's fine as one
byte takes one column. For utf-8, this may result in misaligned ref
summary table.

Introduce gettext_width() function that returns the string length in
columns (currently only supports utf-8 locales). Make the code use
TRANSPORT_SUMMARY(x) where the length is compensated properly in
non-English locales.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c: mark file-scope private symbols as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c: mark a file-scope private symbol as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c: mark a private file-scope symbol as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
graph.c: mark private file-scope symbols as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
rerere.c: mark private file-scope symbols as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes.c: mark a private file-scope symbol as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
symlinks.c: mark private file-scope symbols as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1-array.c: mark a private file-scope symbol as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
strbuf.c: mark a private file-scope symbol as static

Also remove an unused function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c: mark a private file-scope symbol as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
wt-status.c: mark a private file-scope symbol as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
trace.c: mark a private file-scope symbol as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>
ident.c: mark private file-scope symbols as static

Signed-off-by: Junio C Hamano <gitster@pobox.com>