/** * Converts the ref spec templates into {@link RefSpec} instances. * * @return the list of {@link RefSpec} instances. */ @NonNull public final List<RefSpec> asRefSpecs() { // de-duplicate effective ref-specs after substitution of placeholder Set<String> refSpecs = new LinkedHashSet<>(Math.max(this.refSpecs.size(), 1)); for (String template : refSpecs()) { refSpecs.add(template.replaceAll(AbstractGitSCMSource.REF_SPEC_REMOTE_NAME_PLACEHOLDER, remoteName())); } List<RefSpec> result = new ArrayList<>(refSpecs.size()); for (String refSpec : refSpecs) { result.add(new RefSpec(refSpec)); } return result; }