ssh: detect authentication methods

Before calling the credentials callback, ask the sever which
authentication methods it supports and report that to the user, instead
of simply reporting everything that the transport supports.

In case of an error, we do fall back to listing all of them.
ssh: propagate the error code from the auth callback

We need to be able to get a GIT_EUSER back through the outermost call.
Introduce GIT_EAUTH

Introduce this error code to signal an authentication failure.
ssh: request credentials again on authentication failure

Instead of completely giving up on the first failure, ask for
credentials as long as we fail to authenticate.
cred: introduce username-only cred

This exists as ssh needs to know about the username to use before it can
query for the supported authentication methods.
cred: add convenience function to get the username

Since each cred defines the username on their own, introduce
git_cred__username to retrieve the username pointer from them.
ssh: make sure to ask for a username and use the same one

In order to know which authentication methods are supported/allowed by
the ssh server, we need to send a NONE auth request, which needs a
username associated with it.

Most ssh server implementations do not allow switching the username
between authentication attempts, which means we cannot use a dummy
username and then switch. There are two ways around this.

The first is to use a different connection, which an earlier commit
implements, but this increases how long it takes to get set up, and
without knowing the right username, we cannot guarantee that the
list we get in response is the right one.

The second is what's implemented here: if there is no username specified
in the url, ask for it first. We can then ask for the list of auth
methods and use the user's credentials in the same connection.
ssh: adjust clone and push test credentials to the split user+pass method

For urls where we do not specify a username, we must handle the case
where the ssh transport asks us for the username.

Test also that switching username fails.
travis: enable password authentication on OSX

Our ssh tests assume that the server supports password authentication
in a few places. This is convenient as we're not testing authentication
methods, but what happens around them.

Tell sshd on OSX to accept this form of authentication.
Fix unix/posix.h include guard
Only create openssl_locks if thread support is enabled
revwalk: remove preallocation of the uninteresting commits

Preallocating two commits doesn't make much sense as leaving allocation
to the first array usage will allocate a sensible size with room for
growth.

This preallocation has also been hiding issues with strict aliasing in
the tests, as we have fairly simple histories and never trigger the
growth.
array: mark the array to grow as volatile

This works around strict aliasing rules letting some versions of
GCC (particularly on RHEL 6) thinking that they can skip updating the
size of the array when calculating the next element's offset.
Merge pull request #2487 from libgit2/cmn/revwalk-no-prealloc

Work around strict aliasing in array growth
merge: expose multiple merge bases

We always calculate multiple merge bases, but up to now we had only
exposed the "best" merge base.

Introduce git_oidarray which analogously to git_strarray lets us return
multiple ids.
Solaris doesn't necessarily have stdint.h, use inttypes.h
Merge pull request #2503 from jacquesg/solaris-http-parser

Solaris doesn't necessarily have stdint.h, use inttypes.h
Silence unused variables warnings
Define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH if not defined
Cleanup portability/compatibility layer

* Removes mingw-compat.h
* Cleans up separation of compiler/platform idiosyncrasies
* Unifies mingw/msvc stat structures and functions
* (Tries to) hide more compiler specific implementation details (even in our internal API)