Merge "Meaningful error message if project has no parent in source"
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/ListImportedProjects.java b/src/main/java/com/googlesource/gerrit/plugins/importer/ListImportedProjects.java
index d37bf9f..c63db70 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/ListImportedProjects.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/importer/ListImportedProjects.java
@@ -14,7 +14,6 @@
 
 package com.googlesource.gerrit.plugins.importer;
 
-import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
 import com.google.common.io.Files;
 import com.google.gerrit.extensions.annotations.RequiresCapability;
@@ -27,6 +26,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Path;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Locale;
@@ -41,7 +41,7 @@
   @Option(name = "--match", metaVar = "MATCH",
       usage = "List only projects containing this substring, case insensitive")
   public void setMatch(String match) {
-    this.match = match.toLowerCase();
+    this.match = match.toLowerCase(Locale.ENGLISH);
   }
 
   private String match;
@@ -62,15 +62,21 @@
   }
 
   private Collection<File> listImportFiles() {
-    match = Strings.nullToEmpty(match).toLowerCase(Locale.ENGLISH);
     Collection<File> importFiles = new HashSet<>();
-    for (File f : Files.fileTreeTraverser().preOrderTraversal(projects.FS_LAYOUT.getLockRoot())) {
+    File lockRoot = projects.FS_LAYOUT.getLockRoot();
+    Path lockRootPath = lockRoot.toPath();
+    for (File f : Files.fileTreeTraverser().preOrderTraversal(lockRoot)) {
       if (f.isFile()
           && !f.getName().endsWith(".lock")
-          && f.getName().toLowerCase(Locale.ENGLISH).contains(match)) {
+          && matches(lockRootPath.relativize(f.toPath()))) {
         importFiles.add(f);
       }
     }
     return importFiles;
   }
+
+  private boolean matches(Path p) {
+    return match == null
+        || p.toString().toLowerCase(Locale.ENGLISH).contains(match);
+  }
 }
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md
index 838fe6d..9443a4b 100644
--- a/src/main/resources/Documentation/about.md
+++ b/src/main/resources/Documentation/about.md
@@ -80,6 +80,9 @@
 * User accounts must have a username set.
 * User accounts must exist in the target Gerrit server unless auth type
   is 'LDAP', 'HTTP\_LDAP' or 'CLIENT\_SSL\_CERT\_LDAP'.
+* For auth type 'LDAP', 'HTTP\_LDAP' or 'CLIENT\_SSL\_CERT\_LDAP' both,
+  the source and the target Gerrit server must be connected to the same
+  LDAP instance.
 
 For auth type 'LDAP', 'HTTP\_LDAP' or 'CLIENT\_SSL\_CERT\_LDAP' missing
 user accounts are automatically created. The public SSH keys of a user