Add git_repository_init_ext for power initters

The extended version of repository init adds support for many
of the things that you can do with `git init` and sets up
structures that will make it easier to extend further in the
future.
Add template dir and set gid to repo init

This extends git_repository_init_ext further with support for
initializing the repository from an external template directory
and with support for the "create shared" type flags that make a
set GID repository directory.

This also adds tests for much of the new functionality to the
existing `repo/init.c` test suite.

Also, this adds a bunch of new utility functions including a
very general purpose `git_futils_mkdir` (with the ability to
make paths and to chmod the paths post-creation) and a file
tree copying function `git_futils_cp_r`.  Also, this includes
some new path functions that were useful to keep the code
simple.
fix missing validation and type cast warning
Don't reference stack vars in cleanup callback

If you use the clar cleanup callback function, you can't pass a
reference pointer to a stack allocated variable because when the
cleanup function runs, the stack won't exist anymore.
Some cleanup suggested during review

This cleans up a number of items suggested during code review
with @vmg, including:

* renaming "outside repo" config API to `git_config_open_default`
* killing the `git_config_open_global` API
* removing the `git_` prefix from the static functions in fileops
* removing some unnecessary functionality from the "cp" command
Fix warnings and merge issues on Win64
Merge pull request #844 from arrbee/init-extended

Add git_repository_init_ext for power initters
indexer: recognize and mark when all of the packfile has been downloaded

We can't always rely on the network telling us when the download is
finished. Recognize it from the indexer itself.
Fix errors on Win32 with new repo init
New submodule test data
Major submodule rewrite

This replaces the old submodule API with a new extended API that
supports most of the things that can be done with `git submodule`.
Fix valgrind issues and leaks

This fixes up a number of problems flagged by valgrind and also
cleans up the internal `git_submodule` allocation handling
overall with a simpler model.
Working implementation of git_submodule_status

This is a big redesign of the git_submodule_status API and the
implementation of the redesigned API.  It also fixes a number of
bugs that I found in other parts of the submodule API while
writing the tests for the status part.

This also fixes a couple of bugs in the iterators that had not
been noticed before - one with iterating when there is a gitlink
(i.e. separate-work-dir) and one where I was treating anything
even vaguely submodule-like as a submodule, more aggressively
than core git does.
network: add sideband support

This lets us notify the user of what the remote end is doing while we
wait for it to start sending us the packfile.
examples: add progress output to fetch
Fix valgrind warnings and spurious error messages

Just clean up valgrind warnings about uninitialized memory
and also clear out errno in some cases where it results in
a false error message being generated at a later point.
Fix crash with adding internal ignores

Depending on what you had done before adding new items to the
internal ignores list, it was possible for the cache of ignore
data to be uninitialized.
Fix memory leak in cp_r
Support new config locations

As of git v1.7.12, $HOME/.config/git/ is supported as a new
location for "config", "attributes", and "ignore" files.
Merge pull request #876 from arrbee/new-config-locations

new config file locations and defaults