private static boolean canReplaceRemote(@NotNull String path, @NotNull String remotePrefix) {
    path = norm(path);
    remotePrefix = norm(remotePrefix);
    return path.startsWith(remotePrefix) &&
           (path.length() == remotePrefix.length() || remotePrefix.endsWith("/") || path.substring(remotePrefix.length()).startsWith("/"));
  }
private static boolean canReplaceRemote(@NotNull String path, @NotNull String remotePrefix)