private File getMetadataDirectory(final Optional<SamlRegisteredService> registeredService) {
        val path = getAppliesToFor(registeredService);
        val directory = new File(gitRepository.getRepositoryDirectory(), path);
        if (!directory.exists() && registeredService.isEmpty() && !directory.mkdir()) {
            throw new IllegalArgumentException("Metadata directory location " + directory + " cannot be located/created");
        }
        return directory;
    }
This is {@link GitSamlIdPMetadataLocator}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-saml-idp-metadata-git/src/main/java/org/apereo/cas/support/saml/idp/metadata/GitSamlIdPMetadataLocator.java