Added test case to illustrate bogus conflicts detected if no files were merged, and untracked files exist in the workdir.
Only check for workdir conflicts if the index has merged files

Passing 0 as the length of the paths to check to git_diff_index_to_workdir
results in all files being treated as conflicting, that is, all untracked or
modified files in the worktree is reported as conflicting
Remove local unused index_repo variable
global: free the error message when exiting a thread

When we free the global state at thread termination, we must also free
the error message in order not to leak the string once per thread.
Fix typo
Fix attribute lookup in index for bare repos

When using a bare repo with an index, libgit2 attempts to read
files from the index.  It caches those files based on the path
to the file, specifically the path to the directory that contains
the file.

If there is no working directory, we use `git_path_dirname_r` to
get the path to the containing directory.  However, for the
`.gitattributes` file in the root of the repository, this ends up
normalizing the containing path to `"."` instead of the empty
string and the lookup the `.gitattributes` data fails.

This adds a test of attribute lookups on bare repos and also
fixes the problem by simply rewriting `"."` to be `""`.
Factor 40 and 41 constants from source.
Merge pull request #2566 from libgit2/rb/attr-with-bare

Fix attribute lookup in index for bare repos
attr: Cleanup the containing dir logic
Merge pull request #2561 from jacquesg/merge-skip

No files merged may result in bogus merge conflict error
Merge pull request #2565 from linquize/typo

Fix typo
Provide a callback for certificate validation

If the certificate validation fails (or always in the case of ssh),
let the user decide whether to allow the connection.

The data structure passed to the user is the native certificate
information from the underlying implementation, namely OpenSSL or
WinHTTP.
http: send the DER-encoded cert to the callback

Instead of the parsed data, we can ask OpenSSL to give us the
DER-encoded version of the certificate, which the user can then parse
and validate.
remote: add tests for the certificate callback
transport: always call the certificate check callback

We should let the user decide whether to cancel the connection or not
regardless of whether our checks have decided that the certificate is
fine. We provide our own assessment to the callback to let the user fall
back to our checks if they so desire.
ssh: do ssh cert info before asking for credentials

We know the host's key as soon as we connect, so we should perform the
check as soon as we can, before we bother with the user's credentials.
Bring certificate check back to the normal return code

Returning 0 lets the certificate check succeed. An error code is bubbled
up to the user.
winhttp: credential check on successful connect

On successful connection, still ask the user whether they accept the server's certificate, indicating that WinHTTP would let it though.
winhttp: only do certificate check for SSL

If we're not using SSL, don't call the user's certificate check callback.
winhttp: bring together request sending

We need to call WinHttpSendRequest() in three different places. Unify all in a single function to have a single place for the certificate check.