code: func (m FileMode) ToOSFileMode() (os.FileMode, error) {
  	switch m {
  	case Dir:
  		return os.ModePerm | os.ModeDir, nil
  	case Submodule:
  		return os.ModePerm | os.ModeDir, nil
  	case Regular:
  		return os.FileMode(0644), nil
  	// Deprecated is no longer allowed: treated as a Regular instead
  	case Deprecated:
  		return os.FileMode(0644), nil
  	case Executable:
  		return os.FileMode(0755), nil
  	case Symlink:
  		return os.ModePerm | os.ModeSymlink, nil
  	}
  
  	return os.FileMode(0), fmt.Errorf("malformed mode (%s)", m)
  }
docs: // ToOSFileMode returns the os.FileMode to be used when creating file
  // system elements with the given git mode and a nil error on success.
  //
  // When the provided mode cannot be mapped to a valid file system mode
  // (e.g.  Submodule) it returns os.FileMode(0) and an error.
  //
  // The returned file mode does not take into account the umask.