Extract common example helpers and reorg examples

This reorganizes a few of the examples so that the main function
comes first with the argument parsing extracted into a helper
that can come at the end of the file (so the example focuses more
on the use of libgit2 instead of command line support).  This also
creates a shared examples/common.[ch] so that useful helper funcs
can be shared across examples instead of repeated.
init example: deploy helpers, reorg
pack-objects: Depth can be negative
add.c example: deploy helpers, reorg
init.c example: deploy more helpers
indexer: remove the stream infix

It was there to keep it apart from the one which read in from a file on
disk. This other indexer does not exist anymore, so there is no need for
anything other than git_indexer to refer to it.

While here, rename _add() function to _append() and _finalize() to
_commit(). The former change is cosmetic, while the latter avoids
talking about "finalizing", which OO languages use to mean something
completely different.
Remove leftover function declaration
add.c: proper frontmatter
cat-file.c example: deploy helpers, reorg
protocol: basic support for multi_ack_detailed

This tells the server that we speak it, but we don't make use of its
extra information to determine if there's a better place to stop
negotiating.

In a somewhat-related change, reorder the capabilities so we ask for
them in the same order as git does.

Also take this opportunity to factor out a fairly-indented portion of
the negotiation logic.
merge: any non-zero return from the user is an error

This fixes #1703.
Merge pull request #1919 from libgit2/cmn/multi-ack-detailed

protocol: basic support for multi_ack_detailed
rev-list.c example: use common utils, reorganize
Reorganize rev-parse example
Clean up showindex sample
Initialize variables
Test more kinds of bad url
Use gmtime() instead of gmtime_t()

The latter is not available on Windows
Merge pull request #1924 from linquize/gmtime

Use gmtime() instead of gmtime_t()
Add tests for badly-formed URLs