code: def identify_changed_files_from_git_commits(
      patch_sha, target_branch=None, target_ref=None
  ):
      """
      Given a git commit and target ref, use the set of files changed in the diff in order to
      determine which modules' tests should be run.
  
      >>> [x.name for x in determine_modules_for_files( \
              identify_changed_files_from_git_commits("fc0a1475ef", target_ref="5da21f07"))]
      ['graphx']
      >>> 'root' in [x.name for x in determine_modules_for_files( \
           identify_changed_files_from_git_commits("50a0496a43", target_ref="6765ef9"))]
      True
      """
      if target_branch is None and target_ref is None:
          raise AttributeError(
              "must specify either target_branch or target_ref"
          )
      elif target_branch is not None and target_ref is not None:
          raise AttributeError(
              "must specify either target_branch or target_ref, not both"
          )
      if target_branch is not None:
          diff_target = target_branch
          run_cmd(
              [
                  "git",
                  "fetch",
                  "origin",
                  str(target_branch + ":" + target_branch),
              ]
          )
      else:
          diff_target = target_ref
      raw_output = subprocess.check_output(
          ["git", "diff", "--name-only", patch_sha, diff_target],
          universal_newlines=True,
      )
      # Remove any empty strings
      return [f for f in raw_output.split("\n") if f]
  
file_path: spark/dev/sparktestsupport/utils.py
imports: import os
  import sys
  import subprocess
  from sparktestsupport import modules
  from sparktestsupport.shellutils import run_cmd
  from sparktestsupport.toposort import toposort_flatten
label_desc: Use image node_id 2 for calling a global function with example usage: identify_changed_files_from_git_commits(patch_sha, target_branch, target_ref) and returns: unknown