code: func LocalNonBareGitRepositoryIsEmpty(fs fs.FileSystem, dir string) (bool, error) {
  	gitPath := filepath.Join(dir, ".git")
  
  	fi, err := fs.Stat(gitPath)
  	if err != nil {
  		return false, err
  	}
  
  	if !fi.IsDir() {
  		gitPath, err = followGitSubmodule(fs, gitPath)
  		if err != nil {
  			return false, err
  		}
  	}
  
  	// Search for any file in .git/{objects,refs}.  We don't just search the
  	// base .git directory because of the hook samples that are normally
  	// generated with `git init`
  	found := false
  	for _, dir := range []string{"objects", "refs"} {
  		err := fs.Walk(filepath.Join(gitPath, dir), func(path string, info os.FileInfo, err error) error {
  			if err != nil {
  				return err
  			}
  
  			if !info.IsDir() {
  				found = true
  			}
  
  			if found {
  				return filepath.SkipDir
  			}
  
  			return nil
  		})
  
  		if err != nil {
  			return false, err
  		}
  
  		if found {
  			return false, nil
  		}
  	}
  
  	return true, nil
  }
docs: // LocalNonBareGitRepositoryIsEmpty returns true if the non-bare git repository
  // at dir has no refs or objects.  It also handles the case of dir being a
  // checked out git submodule.