public void doImport()

in github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/MagicRefCheckStep.java [43:66]


  public void doImport(ProgressMonitor progress) throws Exception {
    try {
      GHRef[] allRefs = getRepository().getRefs();
      progress.beginTask("Checking magic refs", allRefs.length);

      List<String> offendingRefs = Lists.newLinkedList();
      for (GHRef ref : allRefs) {
        if (MagicBranch.isMagicBranch(ref.getRef())
            || ref.getRef().startsWith(RefNames.REFS_META)) {
          offendingRefs.add(ref.getRef());
        }
        progress.update(1);
      }

      if (!offendingRefs.isEmpty()) {
        throw new MagicRefFoundException(
            String.format(
                "Found %d ref(s): Please remove or rename the following ref(s) and try again: %s",
                offendingRefs.size(), Joiner.on(", ").join(offendingRefs)));
      }
    } finally {
      progress.endTask();
    }
  }