def METHOD_NAME():
  '''Find all changed files in the index.
  Yield each file in the format (octal_mode, filename).
  '''
  git_status_output = subprocess.check_output(["git", "status", "--porcelain=v2"])
  for line in git_status_output.splitlines():
    status_split = line.decode().split()
    #print(status_split)
    if status_split[0] not in ("1", "2"): # Neither modified, new, nor renamed file.
      continue
    if status_split[1][0] not in "MARC":
      # Ignore unmerged and deleted files.
      continue
    index_mode = status_split[4] # This is the octal file mode like 100644.
    # The math below finds the correct target filename.
    target_file_name = status_split[7 + int(status_split[0])]
    yield (index_mode, target_file_name)