code: def find_submodule_git_dir(d):
      
      if is_git_dir(d):
          return d
  
      try:
          with open(d) as fp:
              content = fp.read().rstrip()
      except (IOError, OSError):
          # it's probably not a file
          pass
      else:
          if content.startswith('gitdir: '):
              path = content[8:]
  
              if Git.is_cygwin():
                  ## Cygwin creates submodules prefixed with `/cygdrive/...` suffixes.
                  path = decygpath(path)
              if not osp.isabs(path):
                  path = osp.join(osp.dirname(d), path)
              return find_submodule_git_dir(path)
      # end handle exception
      return None
docs: Search for a submodule repo.