reflog: move the reflog implementation into refdb_fs

References and their logs are logically coupled, let's make it so in
the code by moving the fs-based reflog implementation to live next to
the fs-based refs one.

As part of the change, make the function take names rather than
references, as only the names are relevant when looking up and
handling reflogs.
reflog: add a convenience append function

Provide a function that reads a reflog, performs an append and writes back to the
backend in one call.
reflog: bring _append and _drop back to the frontend

These functions act purely on the reflog data structure.
indexer: do multiple passes over the delta list

Though unusual, a packfile may contain a delta whose base is a delta
that comes later. In order index such a packfile, we must not give up
on the first failure to resolve a delta, but keep it around.

If there is a pass which makes no progress, this indicates that the
packfile is broken, so fail accordingly.
pack: move the object header function here
indexer: fix thin packs

When given an ODB from which to read objects, the indexer will attempt
to inject the missing bases at the end of the pack and update the
header and trailer to reflect the new contents.
net: advertise our support for fixing thin packs
indexer: inject one base at a time

There may be multiple deltas referencing the same base as well as OFS
deltas which rely on a thin delta. Deal with both at the same time by
injecting a single object and going back up to the main
delta-resolving loop.
indexer: clearer stats for thin packs

Don't increase the number of total objects, as it can produce
suprising progress output. The only addition compared to pre-thin is
the addition of local_objects to allow an output similar to git's
"completed with %d local objects".
Rename diff objects and split patch.h

This makes no functional change to diff but renames a couple of
the objects and splits the new git_patch (formerly git_diff_patch)
into a new header file.
Diff API cleanup

This lays groundwork for separating formatting options from diff
creation options.  This groups the formatting flags separately
from the diff list creation flags and reorders the options.  This
also tweaks some APIs to further separate code that uses patches
from code that just looks at git_diffs.
tests for checkout index with conflicts
checkout (from index) can write conflicts
Prevent checkout_tree when conflicts exist, clear NAME on checkout tree

Prevent checkout tree when unresolved changes exist (unless FORCE flag
is specified).  Clear NAME table when checking out, to avoid
checkout_conflicts from attempting to manipulate it.  Ensure that NAME
is also cleared at reset.
checkout rename conflicts

rename conflict tests for checkout conflicts, don't suffix filenames
when checking out with USE_OURS or USE_THEIRS
Get rid of some quick hacks
Don't overwrite ~ files checking out conflicts

If a D/F conflict or rename 2->1 conflict occurs,
we write the file sides as filename~branchname.  If
a file with that name already exists in the working
directory, write as filename~branchname_0 instead.
(Incrementing 0 until a unique filename is found.)
Fix warning, fix memory leak
Honor UPDATE_ONLY bit when checking out conflicts
Two-step conflict checkout (load / perform)

Move conflict handling into two steps: load the conflicts and
then apply the conflicts.  This is more compatible with the
existing checkout implementation and makes progress reporting
more sane.