/** * Create a writer to load objects from the specified reader. * <p> * Objects for packing are specified in {@link #preparePack(Iterator)} or * {@link #preparePack(ProgressMonitor, Set, Set)}. * * @param reader * reader to read from the repository with. */ public PackWriter(ObjectReader reader) { this(new PackConfig(), reader); }
/** * Constructor for GarbageCollectCommand. * * @param repo * a {@link org.eclipse.jgit.lib.Repository} object. */ protected GarbageCollectCommand(Repository repo) { super(repo); pconfig = new PackConfig(repo); }
/** * Create writer for specified repository. * <p> * Objects for packing are specified in {@link #preparePack(Iterator)} or * {@link #preparePack(ProgressMonitor, Set, Set)}. * * @param repo * repository where objects are stored. * @param reader * reader to read from the repository with. */ public PackWriter(Repository repo, ObjectReader reader) { this(new PackConfig(repo), reader); }
/** * Get the configuration used by the pack generator to make packs. * * If {@link #setPackConfig(PackConfig)} was previously given null a new * PackConfig is created on demand by this method using the source * repository's settings. * * @return the pack configuration. Never null. */ public PackConfig getPackConfig() { if (packConfig == null) packConfig = new PackConfig(local); return packConfig; }
private PackWriter newPackWriter() { PackConfig pc = packConfig; if (pc == null) { pc = db != null ? new PackConfig(db) : new PackConfig(); } return new PackWriter(pc, reader != null ? reader : db.newObjectReader()); }
/** * Whether to prune preserved pack files in the preserved directory. * * @since 4.7 * @param prunePreserved * whether to prune preserved pack files * @return this instance */ public GarbageCollectCommand setPrunePreserved(boolean prunePreserved) { if (pconfig == null) pconfig = new PackConfig(repo); pconfig.setPrunePreserved(prunePreserved); return this; }
/** * Whether to preserve old pack files instead of deleting them. * * @since 4.7 * @param preserveOldPacks * whether to preserve old pack files * @return this instance */ public GarbageCollectCommand setPreserveOldPacks(boolean preserveOldPacks) { if (pconfig == null) pconfig = new PackConfig(repo); pconfig.setPreserveOldPacks(preserveOldPacks); return this; }
/** * Initialize a garbage collector. * * @param repository * repository objects to be packed will be read from. */ public DfsGarbageCollector(DfsRepository repository) { repo = repository; refdb = repo.getRefDatabase(); objdb = repo.getObjectDatabase(); newPackDesc = new ArrayList<>(4); newPackStats = new ArrayList<>(4); newPackObj = new ArrayList<>(4); packConfig = new PackConfig(repo); packConfig.setIndexVersion(2); }
}); try (PackWriter pw = new PackWriter( (pconfig == null) ? new PackConfig(repo) : pconfig, repo.newObjectReader())) {
/** * Whether to use aggressive mode or not. If set to true JGit behaves more * similar to native git's "git gc --aggressive". If set to * <code>true</code> compressed objects found in old packs are not reused * but every object is compressed again. Configuration variables * pack.window and pack.depth are set to 250 for this GC. * * @since 3.6 * @param aggressive * whether to turn on or off aggressive mode * @return this instance */ public GarbageCollectCommand setAggressive(boolean aggressive) { if (aggressive) { StoredConfig repoConfig = repo.getConfig(); pconfig.setDeltaSearchWindowSize(repoConfig.getInt( ConfigConstants.CONFIG_GC_SECTION, ConfigConstants.CONFIG_KEY_AGGRESSIVE_WINDOW, DEFAULT_GC_AGGRESSIVE_WINDOW)); pconfig.setMaxDeltaDepth(repoConfig.getInt( ConfigConstants.CONFIG_GC_SECTION, ConfigConstants.CONFIG_KEY_AGGRESSIVE_DEPTH, DEFAULT_GC_AGGRESSIVE_DEPTH)); pconfig.setReuseObjects(false); } else pconfig = new PackConfig(repo); return this; }
/** * @param repo */ protected GarbageCollectCommand(Repository repo) { super(repo); pconfig = new PackConfig(repo); }
/** * Constructor for GarbageCollectCommand. * * @param repo * a {@link org.eclipse.jgit.lib.Repository} object. */ protected GarbageCollectCommand(Repository repo) { super(repo); pconfig = new PackConfig(repo); }
/** * Create a writer to load objects from the specified reader. * <p> * Objects for packing are specified in {@link #preparePack(Iterator)} or * {@link #preparePack(ProgressMonitor, Set, Set)}. * * @param reader * reader to read from the repository with. */ public PackWriter(ObjectReader reader) { this(new PackConfig(), reader); }
/** * Create a writer to load objects from the specified reader. * <p> * Objects for packing are specified in {@link #preparePack(Iterator)} or * {@link #preparePack(ProgressMonitor, Set, Set)}. * * @param reader * reader to read from the repository with. */ public PackWriter(final ObjectReader reader) { this(new PackConfig(), reader); }
/** {@inheritDoc} */ @Override public void autoGC(ProgressMonitor monitor) { GC gc = new GC(this); gc.setPackConfig(new PackConfig(this)); gc.setProgressMonitor(monitor); gc.setAuto(true); gc.setBackground(shouldAutoDetach()); try { gc.gc(); } catch (ParseException | IOException e) { throw new JGitInternalException(JGitText.get().gcFailed, e); } } }
private void compactPacks(DfsReader ctx, ProgressMonitor pm) throws IOException, IncorrectObjectTypeException { DfsObjDatabase objdb = repo.getObjectDatabase(); PackConfig pc = new PackConfig(repo); pc.setIndexVersion(2); pc.setDeltaCompress(false);
cfg = new PackConfig(db); @SuppressWarnings("resource") // PackWriter is referenced in the finally
private void packGarbage(ProgressMonitor pm) throws IOException { PackConfig cfg = new PackConfig(packConfig); cfg.setReuseDeltas(true); cfg.setReuseObjects(true);
@Inject TransferConfig(@GerritServerConfig final Config cfg) { timeout = (int) ConfigUtil.getTimeUnit(cfg, "transfer", null, "timeout", // 0, TimeUnit.SECONDS); packConfig = new PackConfig(); packConfig.setDeltaCompress(false); packConfig.setThreads(1); packConfig.fromConfig(cfg); }
@Inject TransferConfig(@GerritServerConfig final Config cfg) { timeout = (int) ConfigUtil.getTimeUnit(cfg, "transfer", null, "timeout", // 0, TimeUnit.SECONDS); packConfig = new PackConfig(); packConfig.setDeltaCompress(false); packConfig.setThreads(1); packConfig.fromConfig(cfg); }