checkout_index: remove conflicts when checking out new files
checkout_index: Remove stage 0 when checking out conflicts
Merge pull request #2692 from ethomson/bug2515

checkout_index: handle other stages
submodules: add failing test for stale module entries

We consider an entry in .gitmodules to mean that we have a submodule at
a particular path, even if HEAD^{tree} and the index do not contain any
reference to it.

We should ignore that submodule entry and simply consider that path to
be a regular directory.
iterator: submodules are determined by an index or tree

We cannot know from looking at .gitmodules whether a directory is a
submodule or not. We need the index or tree we are comparing against to
tell us. Otherwise we have to assume the entry in .gitmodules is stale
or otherwise invalid.

Thus we pass the index of the repository into the workdir iterator, even
if we do not want to compare against it. This follows what git does,
which even for `git diff <tree>`, it will consider staged submodules as
such.
Merge pull request #2691 from libgit2/cmn/submodule-and-dir

submodules: stale module entries
git_status_file now takes an exact path

This function has one output but can match multiple files, which can be
unexpected for the user, which would usually path the exact path of the
file he wants the status of.
remote: rename _load() to _lookup()

This brings it in line with the rest of the lookup functions.
branch: add getter for the upstream remote name

This gets the value from branch.<foo>.remote.
remote: use git_branch_upstream_remote()

This reduces the clutter somewhat and lets us see what we're asking
about the reference.
remote: don't check for upstream on an anonymous remote

If the remote is anonymous, then we cannot check for any configuration,
as there is no name. Check for this before we try to use the name, which
may be a NULL pointer.

This fixes #2697.
odb: hardcode the empty blob and tree

git hardocodes these as objects which exist regardless of whether they
are in the odb and uses them in the shell interface as a way of
expressing the lack of a blob or tree for one side of e.g. a diff.

In the library we use each language's natural way of declaring a lack of
value which makes a workaround like this unnecessary. Since git uses it,
it does however mean each shell application would need to perform this
check themselves.

This makes it common work across a range of applications and an issue
with compatibility with git, which fits right into what the library aims
to provide.

Thus we introduce the hard-coded empty blob and tree in the odb
frontend. These hard-coded objects are checked for before going to the
backends, but after the cache check, which means the second time they're
used, they will be treated as normal cached objects instead of creating
new ones.
remote: refactor the reference-update decision

This is an ugly chunk of code, so let's put it into its own function.
Merge pull request #2694 from Therzok/statusFile

git_status_file now takes an exact path.
Merge pull request #2696 from libgit2/cmn/empty-objects

odb: hardcode the empty blob and tree
Merge pull request #2695 from libgit2/cmn/remote-lookup

remote: rename _load() to _lookup()
Merge pull request #2698 from libgit2/cmn/fetchhead-refactor

Refactor fetchhead