reflog: follow core.logallrefupdates

On bare by default, or when core.logallrefupdates is false, we must not
write the reflog.
reflog: remove some dead code