code: def _ensure_git_repo(run_dir, resolved_repo_paths):
      git_repo_dir = os.path.join(run_dir, ".git")
      if os.path.exists(git_repo_dir):
          return
      try:
          _ignored = subprocess.check_output(
              ["git", "init"], cwd=run_dir
          )
      except FileNotFoundError:
          raise DvcInitError(
              f"cannot initialize Git in run directory {run_dir} "
              "(required for 'dvc pull') - is Git installed and "
              "available on the path?"
          ) from None
      except subprocess.CalledProcessError:
          if log.getEffectiveLevel() <= logging.DEBUG:
              log.exception("initializing Git repo in %s", run_dir)
          raise DvcInitError(
              f"error initializing Git repo in run directory {run_dir} "
              "(required for 'dvc pull')"
          ) from None
      else:
          resolved_repo_paths.append(git_repo_dir)
  
imports: import json
  import logging
  import os
  import subprocess
  import yaml
  from guild import util
  from guild import var
label_desc: Use image node_id 21 for calling a global function with example usage: _ensure_git_repo(run_dir, resolved_repo_paths) without return types