reflog: follow core.logallrefupdates

On bare by default, or when core.logallrefupdates is false, we must not
write the reflog.

This fixes #2186 and lets libgit2/libgit2sharp#612 enable more testing.