public LfsProjectConfigSection getForProject()

in src/main/java/com/googlesource/gerrit/plugins/lfs/LfsProjectsConfig.java [73:96]


  public LfsProjectConfigSection getForProject(Project.NameKey project) {
    Set<String> namespaces = projectConfig.getSubsections(LfsProjectConfigSection.LFS);
    String p = project.get();
    for (String n : namespaces) {
      if ("?/*".equals(n) || n.endsWith("/?/*")) {
        String prefix = n.substring(0, n.length() - 3);
        Matcher m = Pattern.compile("^" + prefix + "([^/]+)/.*$").matcher(p);
        if (m.matches()) {
          return new LfsProjectConfigSection(projectConfig, n);
        }
      } else if (n.endsWith("/*")) {
        if (p.startsWith(n.substring(0, n.length() - 1))) {
          return new LfsProjectConfigSection(projectConfig, n);
        }
      } else if (n.startsWith("^")) {
        if (p.matches(n.substring(1))) {
          return new LfsProjectConfigSection(projectConfig, n);
        }
      } else if (p.equals(n)) {
        return new LfsProjectConfigSection(projectConfig, n);
      }
    }
    return null;
  }