checkout: Teach checkout to cope with orphaned Head

Fix #1236
Fix Travis compilation warnings
Merge pull request #1238 from nulltoken/fix/checkout-index

checkout: Teach checkout to cope with orphaned Head
status: Enhance git_status_file() test coverage
Simplify git_diff__paired_foreach icase handling
Minor iterator API cleanups

In preparation for further iterator changes, this cleans up a few
small things in the iterator API:

* removed the git_iterator_for_repo_index_range API
* made git_iterator_free not be inlined
* minor param name and test function name tweaks
Fix err msg for ambiguous path in git_status_file

Returning GIT_EAMBIGUOUS from inside the status callback gets
overridden with GIT_EUSER.  `git_status_file` accounted for this
via the callback payload, but was allowing the error message to
be cleared.  Move the `giterr_set` call outside the callback to
where the EUSER case was being dealt with.
Update iterator API with flags for ignore_case

This changes the iterator API so that flags can be passed in to
the constructor functions to control the ignore_case behavior.
At this point, the flags are not supported on tree iterators (i.e.
there is no functional change over the old API), but the API
changes are all made to accomodate this.

By the way, I went with a flags parameter because in the future
I have a couple of other ideas for iterator flags that will make
it easier to fix some diff/status/checkout bugs.
Test for ignore_case ranges on workdir iterator

This adds a test that confirms that the working directory iterator
can actually correctly process ranges of files case insensitively
with proper sorting and proper boundaries.
Add payload "_r" versions of bsearch and tsort

git__bsearch and git__tsort did not pass a payload through to the
comparison function.  This makes it impossible to implement sorted
lists where the sort order depends on external data (e.g. building
a secondary sort order for the entries in a tree).  This commit
adds git__bsearch_r and git__tsort_r versions that pass a third
parameter to the cmp function of a user payload.
Add git_path_icmp to case-insensitive path cmp

This adds git_path_icmp to complement git_path_cmp.
Add git_tree_entry_cmp and git_tree_entry_icmp

This adds a new external API git_tree_entry_cmp and a new internal
API git_tree_entry_icmp for sorting tree entries.  The case
insensitive one is internal only because general users should
never be seeing case-insensitively sorted trees.
Support case insensitive tree iterators and status

This makes tree iterators directly support case insensitivity by
using a secondary index that can be sorted by icase.  Also, this
fixes the ambiguity check in the git_status_file API to also be
case insensitive.  Lastly, this adds new test cases for case
insensitive range boundary checking for all types of iterators.

With this change, it should be possible to deprecate the spool
and sort iterator, but I haven't done that yet.
Shortcut spool and sort for empty iterator
Some doc improvements
Fix indentations
branch: Introduce git_branch_tracking_name()
Merge pull request #1245 from nulltoken/topic/git_branch_tracking_name

Introduce git_branch_tracking_name()
Merge pull request #1248 from sba1/doc-fix

Some doc improvements in transport.h
Merge pull request #1211 from arrbee/fix-icase-status-file

Fix case insensitivity issues in git_status_file