really reset walker with git_revwalk_reset

From the description  of git_revwalk_reset in revwalk.h the function should
clear all pushed and hidden commits, and leave the walker in a blank state (just like at creation).
Apparently everything gets reseted appart of pushed commits (walk->one and walk->twos)

This fix should reset the walker properly.
Introduce GITERR_INDEXER
Ranged iterators and rewritten git_status_file

The goal of this work is to rewrite git_status_file to use the
same underlying code as git_status_foreach.

This is done in 3 phases:

1. Extend iterators to allow ranged iteration with start and
   end prefixes for the range of file names to be covered.
2. Improve diff so that when there is a pathspec and there is
   a common non-wildcard prefix of the pathspec, it will use
   ranged iterators to minimize excess iteration.
3. Rewrite git_status_file to call git_status_foreach_ext
   with a pathspec that covers just the one file being checked.

Since ranged iterators underlie the status & diff implementation,
this is actually fairly efficient.  The workdir iterator does
end up loading the contents of all the directories down to the
single file, which should ideally be avoided, but it is pretty
good.
Fix notes to use new fixed iterator signature
indexer: add more consistency checks

Error out in finalize if there is junk after the packfile hash or we
couldn't process all the objects.
Document git_buf_common_prefix

This function fills in a git_buf with the common prefix of
an array of strings, but let's make that a little more clear.
Merge pull request #703 from carlosmn/consistency

A few indexer consistency checks
Merge pull request #702 from arrbee/fix-status-file

Update git_status_file and add ranged iterators
Merge pull request #700 from cholin/revwalk_reset

really reset walker with git_revwalk_reset
tree: Kill the `git_tree_diff` functions

These are deprecated and replaced with the diffing code in git2/diff.h
clar: Fix warning
tree: Naming conventions
notes: make git_note_foreach() callback signature easier to cope with from a binding perspective
Merge pull request #705 from nulltoken/fix/note_list_callback_signature

notes: make git_note_foreach() callback signature easier to cope with from a binding perspective
Fix status for files under ignored dirs

There was a bug where tracked files inside directories that were
inside ignored directories where not being found by status.  To
make that a little clearer, if you have a .gitignore with:

    ignore/

And then have the following files:

    ignore/dir/tracked     <-- actually a tracked file
    ignore/dir/untracked   <-- should be ignored

Then we would show the tracked file as being removed (because
when we got the to contained item "dir/" inside the ignored
directory, we decided it was safe to skip -- bzzt, wrong!).

This update is much more careful about checking that we are
not skipping over any prefix of a tracked item, regardless of
whether it is ignored or not.

As documented in diff.c, this commit does create behavior that
still differs from core git with regards to the handling of
untracked files contained inside ignored directories.  With
libgit2, those files will just not show up in status or diff.
With core git, those files don't show up in status or diff
either *unless* they are explicitly ignored by a .gitignore
pattern in which case they show up as ignored files.

Needless to say, this is a local behavior difference only, so
it should not be important and (to me) the libgit2 behavior
seems more consistent.
Merge pull request #706 from arrbee/fix_592_again

Fix status for files under ignored dirs
Basic setup for profiling

This fixes the examples so they will build and adds a PROFILE
option to the CMakeFile that enabled gprof info on non-Windows
Optimize away git_text_gather_stats in diff

GProf shows `git_text_gather_stats` as the most expensive call
in large diffs.  The function calculates a lot of information
that is not actually used and does not do so in a optimal
order.  This introduces a tuned `git_buf_is_binary` function
that executes the same algorithm in a fraction of the time.
Other optimization and warning fixes

This fixes a warning left by the earlier optimization and
addresses one of the other hotspots identified by GProf.
Fix workdir iterators on empty directories

Creating a workdir iterator on a directory with absolutely
no files was returning an error (GIT_ENOTFOUND) instead of
an iterator for nothing.  This fixes that and includes two
new tests that cover that case.