def METHOD_NAME(config):
    print("* Restoring webui state...")
    if "webui" not in config:
        print("Error: No webui data saved to config")
        return
    webui_config = config["webui"]
    if "commit_hash" not in webui_config:
        print("Error: No commit saved to webui config")
        return
    webui_commit_hash = webui_config.get("commit_hash", None)
    webui_repo = None
    try:
        if os.path.exists(os.path.join(script_path, ".git")):
            webui_repo = git.Repo(script_path)
    except Exception:
        errors.report(f"Error reading webui git info from {script_path}", exc_info=True)
        return
    try:
        webui_repo.git.fetch(all=True)
        webui_repo.git.reset(webui_commit_hash, hard=True)
        print(f"* Restored webui to commit {webui_commit_hash}.")
    except Exception:
        errors.report(f"Error restoring webui to commit{webui_commit_hash}")