def METHOD_NAME(repo_url: str, repo_storage: FileStorage, repo_name: str, branch: Optional[str] = None, with_git_command: Optional[str] = None) -> None:
    """Deletes the working directory repo_storage.root/repo_name and clones the `repo_url` into it. Will checkout `branch` if provided"""
    try:
        # delete repo folder
        if repo_storage.has_folder(repo_name):
            repo_storage.delete_folder(repo_name, recursively=True, delete_ro=True)
        clone_repo(
            repo_url,
            repo_storage.make_full_path(repo_name),
            branch=branch,
            with_git_command=with_git_command
        ).close()
    except Exception:
        # delete folder so we start clean next time
        if repo_storage.has_folder(repo_name):
            repo_storage.delete_folder(repo_name, recursively=True, delete_ro=True)
        raise