List of usage examples for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_LOGALLREFUPDATES
String CONFIG_KEY_LOGALLREFUPDATES
To view the source code for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_LOGALLREFUPDATES.
Click Source Link
From source file:com.google.gerrit.server.git.LocalDiskRepositoryManager.java
License:Apache License
private Repository createRepository(Path path, Project.NameKey name) throws RepositoryNotFoundException, RepositoryCaseMismatchException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); }//from www . ja va2 s .c o m File dir = FileKey.resolve(path.resolve(name.get()).toFile(), FS.DETECTED); FileKey loc; if (dir != null) { // Already exists on disk, use the repository we found. // loc = FileKey.exact(dir, FS.DETECTED); if (!names.contains(name)) { throw new RepositoryCaseMismatchException(name); } } else { // It doesn't exist under any of the standard permutations // of the repository name, so prefer the standard bare name. // String n = name.get() + Constants.DOT_GIT_EXT; loc = FileKey.exact(path.resolve(n).toFile(), FS.DETECTED); } try { Repository db = RepositoryCache.open(loc, false); db.create(true /* bare */); StoredConfig config = db.getConfig(); config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, true); config.save(); // JGit only writes to the reflog for refs/meta/config if the log file // already exists. // File metaConfigLog = new File(db.getDirectory(), "logs/" + RefNames.REFS_CONFIG); if (!metaConfigLog.getParentFile().mkdirs() || !metaConfigLog.createNewFile()) { log.error(String.format("Failed to create ref log for %s in repository %s", RefNames.REFS_CONFIG, name)); } onCreateProject(name); return db; } catch (IOException e1) { final RepositoryNotFoundException e2; e2 = new RepositoryNotFoundException("Cannot create repository " + name); e2.initCause(e1); throw e2; } }