| | |
| | | } |
| | | |
| | | /** |
| | | * Creates/updates the repository model keyed by reopsitoryName. Saves all |
| | | * Creates/updates the repository model keyed by repositoryName. Saves all |
| | | * repository settings in .git/config. This method allows for renaming |
| | | * repositories and will update user access permissions accordingly. |
| | | * |
| | |
| | | repository.name = repository.name.substring(projectPath.length() + 1); |
| | | } |
| | | } |
| | | boolean isRename = false; |
| | | if (isCreate) { |
| | | // ensure created repository name ends with .git |
| | | if (!repository.name.toLowerCase().endsWith(org.eclipse.jgit.lib.Constants.DOT_GIT_EXT)) { |
| | |
| | | r = JGitUtils.createRepository(repositoriesFolder, repository.name, shared); |
| | | } else { |
| | | // rename repository |
| | | if (!repositoryName.equalsIgnoreCase(repository.name)) { |
| | | isRename = !repositoryName.equalsIgnoreCase(repository.name); |
| | | if (isRename) { |
| | | if (!repository.name.toLowerCase().endsWith( |
| | | org.eclipse.jgit.lib.Constants.DOT_GIT_EXT)) { |
| | | repository.name += org.eclipse.jgit.lib.Constants.DOT_GIT_EXT; |
| | |
| | | logger.error(String.format("failed to call plugin onCreation %s", repositoryName), t); |
| | | } |
| | | } |
| | | } else if (isRename && pluginManager != null) { |
| | | for (RepositoryLifeCycleListener listener : pluginManager.getExtensions(RepositoryLifeCycleListener.class)) { |
| | | try { |
| | | listener.onRename(repositoryName, repository); |
| | | } catch (Throwable t) { |
| | | logger.error(String.format("failed to call plugin onRename %s", repositoryName), t); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |