]> source.dussan.org Git - gitblit.git/commitdiff
Repository cache must be case-insensitive to match permissions
authorJames Moger <james.moger@gitblit.com>
Wed, 31 Oct 2012 20:35:53 +0000 (16:35 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 31 Oct 2012 20:35:53 +0000 (16:35 -0400)
src/com/gitblit/GitBlit.java

index 8355c034e95623e10dde4016391f8bf882ed64fa..35451f622946de1da7fb15f2c8fa7102fb2c1280 100644 (file)
@@ -932,7 +932,7 @@ public class GitBlit implements ServletContextListener {
         */\r
        private void addToCachedRepositoryList(RepositoryModel model) {\r
                if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {\r
-                       repositoryListCache.put(model.name, model);\r
+                       repositoryListCache.put(model.name.toLowerCase(), model);\r
                        \r
                        // update the fork origin repository with this repository clone\r
                        if (!StringUtils.isEmpty(model.originRepository)) {\r
@@ -954,7 +954,7 @@ public class GitBlit implements ServletContextListener {
                if (StringUtils.isEmpty(name)) {\r
                        return null;\r
                }\r
-               return repositoryListCache.remove(name);\r
+               return repositoryListCache.remove(name.toLowerCase());\r
        }\r
 \r
        /**\r
@@ -1188,7 +1188,7 @@ public class GitBlit implements ServletContextListener {
                }\r
                \r
                // cached model\r
-               RepositoryModel model = repositoryListCache.get(repositoryName);\r
+               RepositoryModel model = repositoryListCache.get(repositoryName.toLowerCase());\r
 \r
                if (gcExecutor.isCollectingGarbage(model.name)) {\r
                        // Gitblit is busy collecting garbage, use our cached model\r
@@ -1493,7 +1493,7 @@ public class GitBlit implements ServletContextListener {
                                        // ensure origin still exists\r
                                        File repoFolder = new File(getRepositoriesFolder(), originRepo);\r
                                        if (repoFolder.exists()) {\r
-                                               model.originRepository = originRepo;\r
+                                               model.originRepository = originRepo.toLowerCase();\r
                                        }\r
                                }\r
                        } catch (URISyntaxException e) {\r
@@ -1513,7 +1513,7 @@ public class GitBlit implements ServletContextListener {
                if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {\r
                        // if we are caching use the cache to determine availability\r
                        // otherwise we end up adding a phantom repository to the cache\r
-                       return repositoryListCache.containsKey(repositoryName);\r
+                       return repositoryListCache.containsKey(repositoryName.toLowerCase());\r
                }               \r
                Repository r = getRepository(repositoryName, false);\r
                if (r == null) {\r
@@ -1571,7 +1571,7 @@ public class GitBlit implements ServletContextListener {
                        }\r
                        \r
                        for (String repository : repositoryListCache.keySet()) {\r
-                               if (repository.toLowerCase().startsWith(userPath)) {\r
+                               if (repository.startsWith(userPath)) {\r
                                        RepositoryModel model = repositoryListCache.get(repository);\r
                                        if (!StringUtils.isEmpty(model.originRepository)) {\r
                                                if (roots.contains(model.originRepository)) {\r
@@ -1585,7 +1585,7 @@ public class GitBlit implements ServletContextListener {
                        // not caching\r
                        ProjectModel project = getProjectModel(userProject);\r
                        for (String repository : project.repositories) {\r
-                               if (repository.toLowerCase().startsWith(userProject)) {\r
+                               if (repository.startsWith(userProject)) {\r
                                        RepositoryModel model = repositoryListCache.get(repository);\r
                                        if (model.originRepository.equalsIgnoreCase(origin)) {\r
                                                // user has a fork\r
@@ -1608,7 +1608,7 @@ public class GitBlit implements ServletContextListener {
        public ForkModel getForkNetwork(String repository) {\r
                if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {\r
                        // find the root\r
-                       RepositoryModel model = repositoryListCache.get(repository);\r
+                       RepositoryModel model = repositoryListCache.get(repository.toLowerCase());\r
                        while (model.originRepository != null) {\r
                                model = repositoryListCache.get(model.originRepository);\r
                        }\r
@@ -1619,7 +1619,7 @@ public class GitBlit implements ServletContextListener {
        }\r
        \r
        private ForkModel getForkModel(String repository) {\r
-               RepositoryModel model = repositoryListCache.get(repository);\r
+               RepositoryModel model = repositoryListCache.get(repository.toLowerCase());\r
                ForkModel fork = new ForkModel(model);\r
                if (!ArrayUtils.isEmpty(model.forks)) {\r
                        for (String aFork : model.forks) {\r