Copy git_merge__bases_many() for new ahead-behind code

To be used as a basis for a function which marks nodes with parents
up to the merge base.
Morph copy of git_merge__bases_many() -> mark_parents()

Integrate mark_parents() with the ahead_behind() code.
Fix no_common_ancestor test for ahead_behind count

Ahead-behind count is still a valid operation, even if the two
commits don't have a common merge-base. The old implementation was
buggy, so it returned ENOTFOUND. Fixed now.
Fix mark_parents() to account for bad luck traversals

If commit timestamps are off, we're more likely to hit a traversal
where the first path ends up traversing past the root commit of the tree.
If that happens, it's possible that the loop will complete before the second
path marks some of those final parents. This fix keeps track of the root
nodes that are encountered in the traversal, and verify that they are
properly marked.

In the best case, with accurate timestamps, the traversal will continue
to terminate when all the commits are STALE (parents of a merge-base), as
it did before. In the worst case, where one path makes a complete traversal
past a root commit, we will continue the loop until the root commit itself
is marked.
Fix a bunch of leaks, error handling cases
Add a payload param to git_cred_acquire_cb

Fixes #1128.
Merge pull request #1132 from ben/cred-acquire-payload

Add a payload param to git_cred_acquire_cb
Add git_cred_acquire_cb payload to winhttp transport
Clean up iterator APIs

This removes the need to explicitly pass the repo into iterators
where the repo is implied by the other parameters.  This moves
the repo to be owned by the parent struct.  Also, this has some
iterator related updates to the internal diff API to lay the
groundwork for checkout improvements.
Fix iterator reset and add reset ranges

The `git_iterator_reset` command has not been working in all cases
particularly when there is a start and end range.  This fixes it
and adds tests for it, and also extends it with the ability to
update the start/end range strings when an iterator is reset.
Merge pull request #1133 from arrbee/more-iterator-cleanup

More iterator cleanup
ignore mkmf.log

no build artifacts
no parents
Merge pull request #1135 from ymendel/patch-1

ignore mkmf.log
tree cache: loosen negative entry count check

While C Git has been writing entry count -1 (ie. never other negative
numbers) as invalid since day 1, it accepts all negative entry counts
as invalid. JGit follows the same rule. libgit2 should also follow, or
the index that works with C Git or JGit may someday be rejected by
libgit2.

Other reimplementations like dulwich and grit have not bothered with
parsing or writing tree cache.
Merge pull request #1136 from pclouds/tree-cache-counts

tree cache: loosen negative entry count check
Allow creation of dangling remotes
API to set a dangling remote's repository
don't walk off the end of the index
Convert clone to use dangling remotes
Merge pull request #1139 from ethomson/index_bugfix

don't walk off the end of the index