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.