public @Nullable Repository getExternalRepositoryForFile(@Nullable FilePath file) {
    if (file == null) return null;
    Map<VirtualFile, Repository> repositories = getExternalRepositories();
    for (Map.Entry<VirtualFile, Repository> entry : repositories.entrySet()) {
      if (entry.getKey().isValid() && FileUtil.isAncestor(entry.getKey().getPath(), file.getPath(), false)) {
        return entry.getValue();
      }
    }
    return null;
  }
public @Nullable Repository getExternalRepositoryForFile(@Nullable FilePath file)