refdb: don't update when there's no need

If the caller wants to update a ref to point to the same target as it
currently has, we should return early and avoid writing to the reflog.
reflog: simplify the append logic

Remove some duplicated logic.
reflog: handle the birth of a branch

The reflog append function was overzealous in its checking. When passed
an old and new ids, it should not do any checking, but just serialize
the data to a reflog entry.
reflog: handle symref chains

Given HEAD -> master -> foo, when updating foo's reflog we should also
update HEAD's, as it's considered the current branch.