pretty.c: allow custom placeholder handler

This allows the caller to take part in format_commit_one and handles
some placeholders itself. The caller in mind is "for-each-ref --format".

The caller can even do simple some simple manipulation. Suppose %>(*)
is specified, which format_commit_one() does not understand. The
custom handler can substitute it with, say, %>(30), and pass it back
to format_commit_one.
pretty.c: allow to pass NULL as commit to format_commit_message

The new formatter, for-each-ref, may use non-commit placeholders
only. While it could audit the format line and warn/exclude commit
placeholders, that's a lot more work than simply ignore
them. Unrecognized placeholders are displayed as-is, pretty obvious
that they are not handled.
quote.c: make sq_quote_print a slight wrapper of sq_quote_buf
for-each-ref: convert to use *_quote_buf instead of _quote_print
for-each-ref: avoid printing each element directly to stdout
for-each-ref: use format_commit_message as the main formatter

This brings a whole lot more format specifiers to "for-each-ref
--format". The most interesting are coloring and alignment
specifiers. It comes with shortcomings too as the two formats are
designed separately.

Dead functions are left in place to avoid cluttering the diffs. They
will be removed separately.
for-each-ref: remove dead functions
for-each-ref: introduce format specifier %>(*) and %<(*)

pretty placeholders %>(N) and %<(N) require a user provided width N,
which makes sense because the commit chain could be really long and
the user only needs to look at a few at the top, going to the end just
to calculate the best width wastes CPU cycles and makes Git feel slow.

for-each-ref is different. The display set is small, and we display
them all at once. We even support sorting, which goes through all
display items anyway. This patch introduces new %>(*) and %<(*), which
are supposed to be followed immediately by %(something) (i.e. original
for-each-ref specifiers, not ones coming from pretty.c). They
calculate the best width for the %(something), ignoring ansi escape
sequences if any.