code: func followGitSubmodule(fs fs.FileSystem, gitPath string) (string, error) {
  	f, err := os.Open(gitPath)
  	if err != nil {
  		return "", err
  	}
  	defer f.Close()
  
  	sc := bufio.NewScanner(f)
  	if sc.Scan() {
  		s := sc.Text()
  
  		if strings.HasPrefix(s, "gitdir: ") {
  			newGitPath := s[8:]
  
  			if !filepath.IsAbs(newGitPath) {
  				newGitPath = filepath.Join(filepath.Dir(gitPath), newGitPath)
  			}
  
  			fi, err := fs.Stat(newGitPath)
  			if err != nil && !os.IsNotExist(err) {
  				return "", err
  			}
  			if os.IsNotExist(err) || !fi.IsDir() {
  				return "", fmt.Errorf("gitdir link in .git file %q is invalid", gitPath)
  			}
  			return newGitPath, nil
  		}
  	}
  
  	return "", fmt.Errorf("unable to parse .git file %q", gitPath)
  }
docs: // followGitSubmodule looks at a .git /file/ and tries to retrieve from inside
  // it the gitdir value, which is supposed to indicate the location of the
  // corresponding .git /directory/.  Note: the gitdir value should point directly
  // to the corresponding .git directory even in the case of nested submodules.