code: def get_latest_commits(
      repo_url: str, branch: str = "master", ref: Optional[str] = None
  ) -> List[str]:
      cur = os.getcwd()
      with tempfile.TemporaryDirectory() as tmpdir:
          os.chdir(tmpdir)
  
          clone_cmd = [
              "git",
              "clone",
              "--filter=tree:0",
              "--no-checkout",
              # "--single-branch",
              # "--depth=10",
              f"--branch={branch}",
              repo_url,
              tmpdir,
          ]
          log_cmd = [
              "git",
              "log",
              "-n",
              "10",
              "--pretty=format:%H",
          ]
  
          subprocess.check_output(clone_cmd)
          if ref:
              subprocess.check_output(["git", "checkout", ref])
          commits = (
              subprocess.check_output(log_cmd)
              .decode(sys.stdout.encoding)
              .split("\n")
          )
      os.chdir(cur)
      return commits
  
imports: import importlib
  import os
  import re
  import shlex
  import subprocess
  import sys
  from datetime import datetime
  import tempfile
  import time
  import urllib.request
  from typing import Optional, List, Tuple
  from ray_release.config import parse_python_version
  from ray_release.test import DEFAULT_PYTHON_VERSION
  from ray_release.template import set_test_env_var
  from ray_release.exception import RayWheelsUnspecifiedError, RayWheelsNotFoundError, RayWheelsTimeoutError, ReleaseTestSetupError
  from ray_release.logger import logger
  from ray_release.util import url_exists, python_version_str, resolve_url
  from ray_release.aws import upload_to_s3
label_desc: Use image node_id 2 for calling a global function with example usage: get_latest_commits(repo_url, branch, ref) and returns: commits