From 49658c1ec5b313e5c2798b488e5807b13f796d78 Mon Sep 17 00:00:00 2001 From: Gustaf Lundh Date: Thu, 27 Sep 2012 16:50:42 +0200 Subject: [PATCH] Fix: Projects created outside of Gerrit could not be cloned. The commit: cd94b4b7a381527f9bd216ffc7b7b3180075d16f "Fix case check for project name so that symlinks work again" ...introduced an issue where projects created directly on FS could not be cloned. Effectively rendering new and replicated projects unreachable from gerrit slaves before flushing the projects_list cache and rescanning the filesystem through ssh command "ls-project". A new check is introduced in this patch, allowing projects to be read from FS if they are not found in the names-cache. Change-Id: Iab33b4480179792c1f151e53fc8d037721f01264 --- .../gerrit/server/git/LocalDiskRepositoryManager.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java index cfb2d574b7..4e3f324925 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java @@ -136,7 +136,15 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager { throw new RepositoryNotFoundException("Invalid name: " + name); } if (!names.contains(name)) { - throw new RepositoryNotFoundException(gitDirOf(name)); + // The this.names list does not hold the project-name but it can still exist + // on disk; for instance when the project has been created directly on the + // file-system through replication. + // + if (FileKey.resolve(gitDirOf(name), FS.DETECTED) != null) { + onCreateProject(name); + } else { + throw new RepositoryNotFoundException(gitDirOf(name)); + } } final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); try {