Merge "Fix: Projects created outside of Gerrit could not be cloned."

This commit is contained in:
Edwin Kempin
2012-09-28 01:29:40 -07:00
committed by Gerrit Code Review

View File

@@ -136,8 +136,16 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager {
throw new RepositoryNotFoundException("Invalid name: " + name); throw new RepositoryNotFoundException("Invalid name: " + name);
} }
if (!names.contains(name)) { if (!names.contains(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)); throw new RepositoryNotFoundException(gitDirOf(name));
} }
}
final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED);
try { try {
return RepositoryCache.open(loc); return RepositoryCache.open(loc);