Fix a number of git_odb_exists_prefix bugs

The git_odb_exists_prefix API was not dealing correctly when a
later backend returned GIT_ENOTFOUND even if an earlier backend
had found the object.

Additionally, the unit tests were not properly exercising the API
and had a couple mistakes in checking the results.

Lastly, since the backends are not expected to behavior correctly
unless all bytes of the short id are zero except for the prefix,
this makes the ODB prefix APIs explicitly clear out the extra
bytes so the user doesn't have to be as careful.
Add failing test for git_object_short_id
In-memory packing backend
Retry renaming files on Access Denied errors

When a file is open for reading (without shared-delete permission), and
then a different thread/process called p_rename, that would fail, even
if the file was only open for reading for a few milliseconds. This
change lets p_rename wait up to 50ms for the file to be closed by the
reader. Applies only to win32.

This is especially important for git_filebuf_commit, because writes
should not fail if the file is read simultaneously.

Fixes #2207
Update clar to 4b75388
Merge pull request #2216 from ethomson/clar

Update clar to 4b75388
Don't reset need_pack

While looping over multiple heads, an up-to-date head will clobber the `remote->need_pack` setting, preventing the rest of the machinery from building and downloading a pack-file, breaking fetches.
Merge pull request #2219 from tiennou/reset-need-pack

Don't reset need_pack
Introduce git_merge_head_id
Merge pull request #2222 from ethomson/merge_head_id

Introduce git_merge_head_id
Const up members of git_merge_file_result
Merge pull request #2224 from ethomson/merge_file_const

Const up members of git_merge_file_result
Add faster git_submodule__is_submodule check
Fix submodule sorting in workdir iterator

With the changes to how git_path_dirload_with_stat handles things
that look like submodules, submodules could end up sorted in the
wrong order with the workdir iterator.  This moves the submodule
check earlier in the iterator processing of a new directory so
that the submodule name updates will happen immediately and the
sort order will be correct.
Cleanups
Improve test of submodule name sorting
No need to find merge base.
Merge pull request #2178 from libgit2/rb/fix-short-id

Fix git_odb_short_id and git_odb_exists_prefix bugs
examples: Use git_object_short_id
remote: rename inmemory to anonymous and swap url and fetch order

The order in this function is the opposite to what
create_with_fetchspec() has, so change this one, as url-then-refspec is
what git does.

As we need to break compilation and the swap doesn't do that, let's take
this opportunity to rename in-memory remotes to anonymous as that's
really what sets them apart.