revwalk: clear the flags on reset

These store merge-base information which is only valid for a single run.
revwalk: keep a single list of user inputs

The old separation was due to the old merge-base finding, so it's no
longer necessary.
revwalk: mark uninteresting only up to the common ancestors

This introduces a phase at the start of preparing a walk which pre-marks
uninteresting commits, but only up to the common ancestors.

We do this in a similar way to git, by walking down the history and
marking (which is what we used to do), but we keep a time-sorted
priority queue of commits and stop marking as soon as there are only
uninteresting commits in this queue.

This is a similar rule to the one used to find the merge-base. As we
keep inserting commits regardless of the uninteresting bit, if there are
only uninteresting commits in the queue, it means we've run out of
interesting commits in our walk, so we can stop.

The old mark_unintesting() logic is still in place, but that stops
walking if it finds an already-uninteresting commit, so it will stop on
the ones we've pre-marked; but keeping it allows us to also hide those
that are hidden via the callback.
revwalk: catch no-push and no-hide cases

If there have been no pushes, we can immediately return ITEROVER. If
there have been no hides, we must not run the uninteresting pre-mark
phase, as we do not want to hide anything and this would simply cause us
to spend time loading objects.
revwalk: clear first-parent flag on reset

This should have been included when implementing the feature but was
missed.
Merge pull request #2603 from libgit2/cmn/revwalk-merge-base

Walk only as far as the common ancestors of uninteresting commits