Source:
protected RepositoryModel createRepository(UserModel user, String repository, String action) { boolean isPush = !StringUtils.isEmpty(action) && gitReceivePack.equals(action); if (action.equals(gitLfs)) { return null; }; if (isPush) { if (user.canCreate(repository)) { if (repository.startsWith("../")) { logger.error(MessageFormat.format("Illegal relative path in repository name! {0}", repository)); return null; } if (repository.contains("/../")) { logger.error(MessageFormat.format("Illegal relative path in repository name! {0}", repository)); return null; } Character c = StringUtils.findInvalidCharacter(repository); if (c != null) { logger.error(MessageFormat.format("Invalid character '{0}' in repository name {1}!", c, repository)); return null; } RepositoryModel model = new RepositoryModel(); model.name = repository; model.addOwner(user.username); model.projectPath = StringUtils.getFirstPathElement(repository); if (model.isUsersPersonalRepository(user.username)) { model.authorizationControl = AuthorizationControl.NAMED; model.accessRestriction = AccessRestrictionType.VIEW; } else { model.authorizationControl = AuthorizationControl.fromName(settings.getString(Keys.git.defaultAuthorizationControl, "")); model.accessRestriction = AccessRestrictionType.fromName(settings.getString(Keys.git.defaultAccessRestriction, "PUSH")); } try { repositoryManager.updateRepositoryModel(model.name, model, true); logger.info(MessageFormat.format("{0} created {1} ON-PUSH", user.username, model.name)); return repositoryManager.getRepositoryModel(model.name); } catch (GitBlitException e) { logger.error(MessageFormat.format("{0} failed to create repository {1} ON-PUSH!", user.username, model.name), e); } } else { logger.warn(MessageFormat.format("{0} is not permitted to create repository {1} ON-PUSH!", user.username, repository)); } } return null; }

Target:
protected RepositoryModel createRepository(UserModel user, String repository, String action) { boolean isPush = !StringUtils.isEmpty(action) && gitReceivePack.equals(action); if (action.equals(gitLfs)) { return null; } if (isPush) { if (user.canCreate(repository)) { if (repository.startsWith("../")) { logger.error(MessageFormat.format("Illegal relative path in repository name! {0}", repository)); return null; } if (repository.contains("/../")) { logger.error(MessageFormat.format("Illegal relative path in repository name! {0}", repository)); return null; } Character c = StringUtils.findInvalidCharacter(repository); if (c != null) { logger.error(MessageFormat.format("Invalid character '{0}' in repository name {1}!", c, repository)); return null; } RepositoryModel model = new RepositoryModel(); model.name = repository; model.addOwner(user.username); model.projectPath = StringUtils.getFirstPathElement(repository); if (model.isUsersPersonalRepository(user.username)) { model.authorizationControl = AuthorizationControl.NAMED; model.accessRestriction = AccessRestrictionType.VIEW; } else { model.authorizationControl = AuthorizationControl.fromName(settings.getString(Keys.git.defaultAuthorizationControl, "")); model.accessRestriction = AccessRestrictionType.fromName(settings.getString(Keys.git.defaultAccessRestriction, "PUSH")); } try { repositoryManager.updateRepositoryModel(model.name, model, true); logger.info(MessageFormat.format("{0} created {1} ON-PUSH", user.username, model.name)); return repositoryManager.getRepositoryModel(model.name); } catch (GitBlitException e) { logger.error(MessageFormat.format("{0} failed to create repository {1} ON-PUSH!", user.username, model.name), e); } } else { logger.warn(MessageFormat.format("{0} is not permitted to create repository {1} ON-PUSH!", user.username, repository)); } } return null; }