sha1_file: be paranoid when creating loose objects