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 #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