| | |
| | | */
|
| | | private void addToCachedRepositoryList(RepositoryModel model) {
|
| | | if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
|
| | | repositoryListCache.put(model.name, model);
|
| | | repositoryListCache.put(model.name.toLowerCase(), model);
|
| | |
|
| | | // update the fork origin repository with this repository clone
|
| | | if (!StringUtils.isEmpty(model.originRepository)) {
|
| | |
| | | if (StringUtils.isEmpty(name)) {
|
| | | return null;
|
| | | }
|
| | | return repositoryListCache.remove(name);
|
| | | return repositoryListCache.remove(name.toLowerCase());
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | // cached model
|
| | | RepositoryModel model = repositoryListCache.get(repositoryName);
|
| | | RepositoryModel model = repositoryListCache.get(repositoryName.toLowerCase());
|
| | |
|
| | | if (gcExecutor.isCollectingGarbage(model.name)) {
|
| | | // Gitblit is busy collecting garbage, use our cached model
|
| | |
| | | // ensure origin still exists
|
| | | File repoFolder = new File(getRepositoriesFolder(), originRepo);
|
| | | if (repoFolder.exists()) {
|
| | | model.originRepository = originRepo;
|
| | | model.originRepository = originRepo.toLowerCase();
|
| | | }
|
| | | }
|
| | | } catch (URISyntaxException e) {
|
| | |
| | | if (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);
|
| | | return repositoryListCache.containsKey(repositoryName.toLowerCase());
|
| | | }
|
| | | Repository r = getRepository(repositoryName, false);
|
| | | if (r == null) {
|
| | |
| | | }
|
| | |
|
| | | for (String repository : repositoryListCache.keySet()) {
|
| | | if (repository.toLowerCase().startsWith(userPath)) {
|
| | | if (repository.startsWith(userPath)) {
|
| | | RepositoryModel model = repositoryListCache.get(repository);
|
| | | if (!StringUtils.isEmpty(model.originRepository)) {
|
| | | if (roots.contains(model.originRepository)) {
|
| | |
| | | // not caching
|
| | | ProjectModel project = getProjectModel(userProject);
|
| | | for (String repository : project.repositories) {
|
| | | if (repository.toLowerCase().startsWith(userProject)) {
|
| | | if (repository.startsWith(userProject)) {
|
| | | RepositoryModel model = repositoryListCache.get(repository);
|
| | | if (model.originRepository.equalsIgnoreCase(origin)) {
|
| | | // user has a fork
|
| | |
| | | public ForkModel getForkNetwork(String repository) {
|
| | | if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
|
| | | // find the root
|
| | | RepositoryModel model = repositoryListCache.get(repository);
|
| | | RepositoryModel model = repositoryListCache.get(repository.toLowerCase());
|
| | | while (model.originRepository != null) {
|
| | | model = repositoryListCache.get(model.originRepository);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | private ForkModel getForkModel(String repository) {
|
| | | RepositoryModel model = repositoryListCache.get(repository);
|
| | | RepositoryModel model = repositoryListCache.get(repository.toLowerCase());
|
| | | ForkModel fork = new ForkModel(model);
|
| | | if (!ArrayUtils.isEmpty(model.forks)) {
|
| | | for (String aFork : model.forks) {
|