From d9c567a622447461a6b5e934544882d1746de870 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Sat, 22 Dec 2012 00:26:35 -0500 Subject: [PATCH] Cleanup working folders for git servlet unit tests --- src/com/gitblit/GitBlit.java | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index 782da63..076bb76 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -1652,7 +1652,18 @@ * @return true if the repository exists */ public boolean hasRepository(String repositoryName) { - if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) { + return hasRepository(repositoryName, false); + } + + /** + * Determines if this server has the requested repository. + * + * @param name + * @param caseInsensitive + * @return true if the repository exists + */ + public boolean hasRepository(String repositoryName, boolean caseSensitiveCheck) { + if (!caseSensitiveCheck && settings.getBoolean(Keys.git.cacheRepositoryList, true)) { // if we are caching use the cache to determine availability // otherwise we end up adding a phantom repository to the cache return repositoryListCache.containsKey(repositoryName.toLowerCase()); @@ -1937,7 +1948,7 @@ if (!repository.name.toLowerCase().endsWith(org.eclipse.jgit.lib.Constants.DOT_GIT_EXT)) { repository.name += org.eclipse.jgit.lib.Constants.DOT_GIT_EXT; } - if (new File(repositoriesFolder, repository.name).exists()) { + if (hasRepository(repository.name)) { throw new GitBlitException(MessageFormat.format( "Can not create repository ''{0}'' because it already exists.", repository.name)); -- Gitblit v1.9.1