public void run() throws Exception { try { LOGGER.info("Before GC: {}", git.gc().getStatistics()); LOGGER.debug("Before GC: Size - {}", getConfigRepoDisplaySize()); long expireTimeInMs = systemEnvironment.getConfigGitGCExpireTime(); git.gc().setAggressive(systemEnvironment.get(SystemEnvironment.GO_CONFIG_REPO_GC_AGGRESSIVE)) .setExpire(new Date(System.currentTimeMillis() - expireTimeInMs)) .call(); LOGGER.info("After GC: {}", git.gc().getStatistics()); LOGGER.debug("After GC: Size: {}", getConfigRepoDisplaySize()); } catch (GitAPIException e) { LOGGER.error("Could not perform GC", e); throw e; } } });
public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { try (Git git = new Git(repository)) { Properties ret = git.gc(). setProgressMonitor(new PrintlnProgressMonitor()).call(); for(Map.Entry<Object, Object> entry : ret.entrySet()) { System.out.println("Ret: " + entry.getKey() + ": " + entry.getValue()); } } } }
public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { try (Git git = new Git(repository)) { Properties ret = git.gc(). setProgressMonitor(new PrintlnProgressMonitor()).call(); for(Map.Entry<Object, Object> entry : ret.entrySet()) { System.out.println("Ret: " + entry.getKey() + ": " + entry.getValue()); } } } }
public Void call(Git git, GitContext context) throws Exception { long before = System.currentTimeMillis(); try { git.gc().call(); LOGGER.debug("git gc took " + ((System.currentTimeMillis() - before)) + " ms."); } catch (GitAPIException e) { LOGGER.debug("git gc threw an exception!", e); } return null; } };
private void execute(Repository repository, GarbageCollectCommand gcc) throws GitAPIException { Properties properties = gcc.call(); logger.info(message(repository, properties, "after")); }
public Void call(Git git, GitContext context) throws Exception { long before = System.currentTimeMillis(); try { git.gc().call(); LOGGER.debug("git gc took " + ((System.currentTimeMillis() - before)) + " ms."); } catch (GitAPIException e) { LOGGER.debug("git gc threw an exception!", e); } return null; } };
@Override public Void call() { try { LOGGER.info("Start running `git gc` command to clean up git garbage"); final Properties call = getGit().gc().call(); LOGGER.info("`git gc` has been completed " + call.toString()); } catch (final GitAPIException e) { LOGGER.error("Failed to run `git gc` command.", e); } return null; } });
@Override public Void call() { try { LOGGER.info("Start running `git gc` command to clean up git garbage"); final Properties call = getGit().gc().call(); LOGGER.info("`git gc` has been completed " + call.toString()); } catch (final GitAPIException e) { LOGGER.error("Failed to run `git gc` command.", e); } return null; } });
protected void doGc(Exchange exchange, String operation) throws Exception { Properties result = null; try { result = git.gc().call(); } catch (Exception e) { LOG.error("There was an error in Git {} operation", operation); throw e; } updateExchange(exchange, result); }
public void execute() { try { if (!(git.getRepository().getRefDatabase() instanceof RefTreeDatabase)) { git._gc().call(); } } catch (GitAPIException e) { throw new RuntimeException(e); } } }
private void doCommit(Git git, GitContext context) { try { String message = context.getCommitMessage(); IllegalStateAssertion.assertTrue(message.length() > 0, "Empty commit message"); // git add --all git.add().addFilepattern(".").call(); // git commit -m message git.commit().setMessage(message).call(); if (--commitsWithoutGC < 0) { commitsWithoutGC = MAX_COMMITS_WITHOUT_GC; LOGGER.debug("Performing 'git gc' after {} commits", MAX_COMMITS_WITHOUT_GC); git.gc().call(); } } catch (GitAPIException ex) { throw FabricException.launderThrowable(ex); } }
private void doCommit(Git git, GitContext context) { try { String message = context.getCommitMessage(); IllegalStateAssertion.assertTrue(message.length() > 0, "Empty commit message"); // git add --all git.add().addFilepattern(".").call(); // git commit -m message git.commit().setMessage(message).call(); if (--commitsWithoutGC < 0) { commitsWithoutGC = MAX_COMMITS_WITHOUT_GC; LOGGER.debug("Performing 'git gc' after {} commits", MAX_COMMITS_WITHOUT_GC); git.gc().call(); } } catch (GitAPIException ex) { throw FabricException.launderThrowable(ex); } }
LOGGER.info("Performing 'git gc' after {} merges", MAX_MERGES_WITHOUT_GC); try { git.gc().setAggressive(true).call(); } catch (Exception e) { LOGGER.warn("Problem invoking 'git gc': {}", e.getMessage());