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
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
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.
Merge pull request #2206 from libgit2/cmn/inmemory-swap-order

Rename in-memory remote to anonymous and swap url and fetch order
Merge pull request #2228 from mekishizufu/example_short_id

Use git_object_short_id in examples
Add CFLAGS -Wdeclaration-after-statement

This warns local variables declarations after statement, which helps not to break MSVC
Merge pull request #2229 from linquize/Wdeclaration-after-statement

Add CFLAGS -Wdeclaration-after-statement