in git-server/src/main/java/jetbrains/buildServer/buildTriggers/vcs/git/Cleanup.java [574:618]
private void runNativeGC(final File bareGitDir) {
String pathToGit = myConfig.getPathToGit();
try {
final long start = System.currentTimeMillis();
GeneralCommandLine cl = new GeneralCommandLine();
cl.setWorkingDirectory(bareGitDir.getParentFile());
cl.setExePath(pathToGit);
cl.addParameter("--git-dir="+bareGitDir.getCanonicalPath());
cl.addParameter("gc");
cl.addParameter("--auto");
cl.addParameter("--quiet");
ExecResult result = SimpleCommandLineProcessRunner.runCommand(cl, null, new SimpleCommandLineProcessRunner.ProcessRunCallback() {
public void onProcessStarted(@NotNull Process ps) {
CLEANUP.info("Start 'git --git-dir=" + bareGitDir.getAbsolutePath() + " gc'");
}
public void onProcessFinished(@NotNull Process ps) {
final long finish = System.currentTimeMillis();
CLEANUP.info("Finish 'git --git-dir=" + bareGitDir.getAbsolutePath() + " gc', duration: " + (finish - start) + "ms");
}
public Integer getOutputIdleSecondsTimeout() {
return 60 * myConfig.getNativeGCQuotaMinutes();
}
public Integer getMaxAcceptedOutputSize() {
return null;
}
@Override
public boolean terminateEntireProcessTree() {
return true;
}
});
VcsException commandError = CommandLineUtil.getCommandLineError("'git --git-dir=" + bareGitDir.getAbsolutePath() + " gc'", result);
if (commandError != null) {
CLEANUP.warnAndDebugDetails("Error while running 'git --git-dir=" + bareGitDir.getAbsolutePath() + " gc'", commandError);
}
if (result.getStderr().length() > 0) {
CLEANUP.debug("Output produced by 'git --git-dir=" + bareGitDir.getAbsolutePath() + " gc'");
CLEANUP.debug(result.getStderr());
}
} catch (Exception e) {
myGcErrors.registerError(bareGitDir, e);
CLEANUP.warnAndDebugDetails("Error while running 'git --git-dir=" + bareGitDir.getAbsolutePath() + " gc'", e);
}
}