code: def _iter_expand_paths(self, paths):
          
          def raise_exc(e):
              raise e
          r = self.repo.working_tree_dir
          rs = r + os.sep
          for path in paths:
              abs_path = path
              if not osp.isabs(abs_path):
                  abs_path = osp.join(r, path)
              # END make absolute path
  
              try:
                  st = os.lstat(abs_path)     # handles non-symlinks as well
              except OSError:
                  # the lstat call may fail as the path may contain globs as well
                  pass
              else:
                  if S_ISLNK(st.st_mode):
                      yield abs_path.replace(rs, '')
                      continue
              # end check symlink
  
              # resolve globs if possible
              if '?' in path or '*' in path or '[' in path:
                  resolved_paths = glob.glob(abs_path)
                  # not abs_path in resolved_paths:
                  #   a glob() resolving to the same path we are feeding it with
                  #   is a glob() that failed to resolve. If we continued calling
                  #   ourselves we'd endlessly recurse. If the condition below
                  #   evaluates to true then we are likely dealing with a file
                  #   whose name contains wildcard characters.
                  if abs_path not in resolved_paths:
                      for f in self._iter_expand_paths(glob.glob(abs_path)):
                          yield f.replace(rs, '')
                      continue
              # END glob handling
              try:
                  for root, dirs, files in os.walk(abs_path, onerror=raise_exc):  # @UnusedVariable
                      for rela_file in files:
                          # add relative paths only
                          yield osp.join(root.replace(rs, ''), rela_file)
                      # END for each file in subdir
                  # END for each subdirectory
              except OSError:
                  # was a file or something that could not be iterated
                  yield path.replace(rs, '')
docs: Expand the directories in list of paths to the corresponding paths accordingly,
  
          Note: git will add items multiple times even if a glob overlapped
          with manually specified paths or if paths where specified multiple
          times - we respect that and do not prune