public String getMetaConfigFile()

in src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/FormatterUtil.java [287:312]


  public String getMetaConfigFile(String projectName, String fileName) {
    try (Repository repo = repoManager.openRepository(new Project.NameKey(projectName))) {
      try (RevWalk rw = new RevWalk(repo)) {
        ObjectId id = repo.resolve(RefNames.REFS_CONFIG);
        if (id == null) {
          return null;
        }
        RevCommit commit = rw.parseCommit(id);
        RevTree tree = commit.getTree();
        try (TreeWalk tw = new TreeWalk(repo)) {
          tw.addTree(tree);
          tw.setRecursive(true);
          tw.setFilter(PathFilter.create(pluginName + "/" + fileName));
          if (!tw.next()) {
            return null;
          }
          ObjectId objectId = tw.getObjectId(0);
          ObjectLoader loader = repo.open(objectId);
          byte[] raw = loader.getBytes(Integer.MAX_VALUE);
          return new String(raw, UTF_8);
        }
      }
    } catch (IOException e) {
      return null;
    }
  }