code: def query_changed_files() -> List[str]:
      default_branch = (
          f"origin/{os.environ.get('GIT_DEFAULT_BRANCH', 'main')}"
      )
      merge_base = (
          subprocess.check_output(
              ["git", "merge-base", default_branch, "HEAD"]
          )
          .decode()
          .strip()
      )
  
      head = (
          subprocess.check_output(["git", "rev-parse", "HEAD"])
          .decode()
          .strip()
      )
  
      base_commit = merge_base
      if base_commit == head:
          # We are on the default branch, so check for changes since the last commit
          base_commit = "HEAD^"
  
      proc = subprocess.run(
          ["git", "diff", "--name-only", base_commit, "HEAD"],
          capture_output=True,
          check=False,
      )
  
      if proc.returncode != 0:
          raise RuntimeError("Unable to get changed files")
  
      lines = proc.stdout.decode().strip().split("\n")
      lines = [line.strip() for line in lines]
      return lines
  
file_path: pytorch/tools/testing/target_determination/heuristics/utils.py
imports: import json
  import os
  import subprocess
  from collections import defaultdict
  from pathlib import Path
  from typing import cast, Dict, List, Set, Union
  from warnings import warn
label_desc: Use image node_id 2 for calling a global function with example usage: query_changed_files() and returns: lines