reflog: integrate into the ref writing

Whenever a reference is created or updated, we need to write to the
reflog regardless of whether the user gave us a message, so we shouldn't
leave that to the ref frontend, but integrate it into the backend.

This also eliminates the race between ref update and writing to the
reflog, as we protect the reflog with the ref lock.

As an additional benefit, this reflog append on the backend happens by
appending to the file instead of parsing and rewriting it.
reflog: remove git_reflog_append_to()

This was a convenience method for the refs front-end to do the reflog
writing. This is now done in the backend and it has no more reason for
being.
reflog: write to the reflog following git's rules

git-core only writes to the reflogs of HEAD, refs/heads/ and,
refs/notes/ or if there is already a reflog in place. Adjust our code to
follow these semantics.
refs: expose a way to ensure a ref has a log

Sometimes (e.g. stash) we want to make sure that a log will be written,
even if it's not in one of the standard locations. Let's make that
easier.
refs: expose has_log() on the backend

The frontend used to look at the file directly, but that's obviously not
the right thing to do. Expose it on the backend and use that function
instead.