remote: correctly interpret tagopt '--tags'

When tagopt is set to '--tags', we should only take the default tags
refspec into account and ignore any configured ones.

Bring the code into compliance.
Fix win32 type warnings
Merge pull request #1557 from carlosmn/tagopt

remote: correctly interpret tagopt '--tags'
repo: unconditionally create a global config backend

When a repository is initialised, we need to probe to see if there is
a global config to load. If this is not the case, the user isn't able
to write to the global config without creating the backend and adding
it themselves, which is inconvenient and overly complex.

Unconditionally create and add a backend for the global config file
regardless of whether it exists as a convenience for users.

To enable this, we allow creating backends to files that do not exist
yet, changing the semantics somewhat, and making some tests invalid.
config: convenience function to open global/xdg

The rules for which one to open is a bit silly, so let's make it
easier for our users.
Expose git_reference_dwim

Extract this function out of the rev-parse code to be able to DWIM a
reference instead of its target.
Merge pull request #1552 from carlosmn/config-helpers

Config helpers for global/xdg config files
Fix dumb type in time comparison
Merge pull request #1561 from arrbee/fix-windows-diff-eofnl

Fix windows diff eofnl error
Merge pull request #1560 from carlosmn/ref-dwim

Expose git_reference_dwim
Fix git_repository_message docs

This clarifies the docs for git_repository_message and also adds
to the tests to explicitly check NUL termination of data when the
output buffer is smaller than the message size.  There is a minor
behavior change so that a non-NULL output buffer will always be
NUL terminated (at length zero) if an error occurs.
Merge pull request #1563 from arrbee/doc-fix-repo-message

Fix git_repository_message docs
calloc refs instead of malloc'ing them
Merge pull request #1566 from ethomson/ref_zero

calloc refs instead of malloc'ing them
clone: fix -Wmaybe-uninitialized warning
Improve ignore handling in git_status_file

The git_status_file API was doing a hack to deal with files that
are inside ignored directories.  The status scan was not reporting
any file in this case, so git_status_file would attempt a final
"stat()" call, and return IGNORED if the file actually existed.

On case-insensitive filesystems where core.ignorecase is set
incorrectly, this magic check can "succeed" and report a file
as ignored when it should actually return ENOTFOUND.

Now that we have the GIT_STATUS_OPT_RECURSE_IGNORED_DIRS, we can
use that flag to make sure that git_status_file() will look into
ignored directories and eliminate the hack completely, so we give
the correct error.
Fix diff output for renames and copies

If you use rename detection, the renamed and copied files would
not show any text diffs because the function that decides if
data should be loaded didn't know which sides of the diff to
load for those cases.

This adds a test that looks at the patch generated for diff
entries that are COPIED or RENAMED.
Fix some memory leaks
Merge pull request #1573 from nulltoken/fix/leaks

Fix some memory leaks
Merge pull request #1572 from arrbee/diff-patch-with-rename

Fix diff output for renames and copies