code: func NewFromOSFileMode(m os.FileMode) (FileMode, error) {
  	if m.IsRegular() {
  		if isSetTemporary(m) {
  			return Empty, fmt.Errorf("no equivalent git mode for %s", m)
  		}
  		if isSetCharDevice(m) {
  			return Empty, fmt.Errorf("no equivalent git mode for %s", m)
  		}
  		if isSetUserExecutable(m) {
  			return Executable, nil
  		}
  		return Regular, nil
  	}
  
  	if m.IsDir() {
  		return Dir, nil
  	}
  
  	if isSetSymLink(m) {
  		return Symlink, nil
  	}
  
  	return Empty, fmt.Errorf("no equivalent git mode for %s", m)
  }
docs: // NewFromOSFileMode returns the FileMode used by git to represent
  // the provided file system modes and a nil error on success.  If the
  // file system mode cannot be mapped to any valid git mode (as with
  // sockets or named pipes), it will return Empty and an error.
  //
  // Note that some git modes cannot be generated from os.FileModes, like
  // Deprecated and Submodule; while Empty will be returned, along with an
  // error, only when the method fails.