private function applyPatch($patches): void
    {
        $homeDir = $this->parameters->get('dotfiles.home_dir');
        $this->debug('start applying patch to '.$homeDir);
        $fs = new Filesystem();
        foreach ($patches as $relPath => $patch) {
            $contents = implode(PHP_EOL, $patch);
            $target = $homeDir.DIRECTORY_SEPARATOR.$relPath;
            $this->debug('+patch '.$target);
            Toolkit::ensureFileDir($target);
            $fs->patch($target, $contents);
        }
    }