Be more thread aware with some index updates

The index isn't really thread safe for the most part, but we can
easily be more careful and avoid double frees and the like, which
are serious problems (as opposed to a lookup which might return
the incorrect value but if the index in being updated, that is
much harder to avoid).
Fix a crash if git_remote_set_cred_acquire_cb wasn't called before connecting.

Fixes #1700.
Fix a probable leak.
Add some missing error messages.
Tab indent.
Merge branch 'ssh-cred-fix' of tiennou/libgit2

Conflicts:
	src/transports/ssh.c
Bring SSH error reporting up to base standards

The SSH error checking and reporting could still be further
improved by using the libssh2 native methods to get error info,
but at least this ensures that all error codes are checked and
translated into libgit2 error messages.
trivial whitespace fixup
Merge pull request #1717 from libgit2/arrbee/pr-1706-merged-and-cleaned

PR 1706 plus error reporting cleanups
Merge pull request #1705 from arrbee/avoid-index-double-free

Try harder not to double free index entries