Fix string out of bounds in GitProjectImporter
If $gerrit.basePath contains ".git" in the top level directory (that is, its a Git repository with a working directory), don't try to import a project with an empty name. Skip the path. Change-Id: I1eaf1e0a6189771ccb827094d0419c26ec7f03a2 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
e3e9a9e825
commit
53ad356d96
@ -79,6 +79,13 @@ public class GitProjectImporter {
|
||||
|
||||
if (FileKey.isGitRepository(f, FS.DETECTED)) {
|
||||
if (name.equals(".git")) {
|
||||
if ("".equals(prefix)) {
|
||||
// If the git base path is itself a git repository working
|
||||
// directory, this is a bit nonsensical for Gerrit Code Review.
|
||||
// Skip the path and do the next one.
|
||||
messages.warning("Skipping " + f.getAbsolutePath());
|
||||
continue;
|
||||
}
|
||||
name = prefix.substring(0, prefix.length() - 1);
|
||||
|
||||
} else if (name.endsWith(".git")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user