This avoids some small overhead by only running the check once per command; it also ensures that, even if the command doesn't find anything to run on, it still fails to run when in a bare repo.
Handles our file right, but not theirs.
Automatic merge resoltion code needs to be fixed to preserve objects from direct mode files.