void checkForDuplicatesAgainstTheWholeTree()

in src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/DuplicatePathnameValidator.java [225:248]


  void checkForDuplicatesAgainstTheWholeTree(
      TreeWalk tw, Set<String> changed, List<CommitValidationMessage> messages) throws IOException {
    Map<String, String> all = allPaths(changed);

    while (tw.next()) {
      String currentPath = tw.getPathString();

      if (isDeleted(tw)) {
        continue;
      }

      String potentialDuplicate = all.get(currentPath.toLowerCase(locale));
      if (potentialDuplicate == null) {
        continue;
      } else if (potentialDuplicate.equals(currentPath)) {
        if (tw.isSubtree()) {
          tw.enterSubtree();
        }
        continue;
      } else {
        messages.add(conflict(potentialDuplicate, currentPath));
      }
    }
  }