String[] args, PrintStream outRedirect, PrintStream errRedirect, String stdinArgs) throws JGitInternalException { return new ProcessResult(Status.NOT_SUPPORTED);
/** * Whether the execution occurred and resulted in an error * * @return <code>true</code> if the execution occurred and resulted in a * return code different from 0, <code>false</code> otherwise. * @since 4.0 */ public boolean isExecutedWithError() { return getStatus() == ProcessResult.Status.OK && getExitCode() != 0; } }
/** * Runs the hook, without performing any validity checks. * * @throws org.eclipse.jgit.api.errors.AbortedByHookException * If the underlying hook script exited with non-zero. */ protected void doRun() throws AbortedByHookException { final ByteArrayOutputStream errorByteArray = new ByteArrayOutputStream(); PrintStream hookErrRedirect = null; try { hookErrRedirect = new PrintStream(errorByteArray, false, UTF_8.name()); } catch (UnsupportedEncodingException e) { // UTF-8 is guaranteed to be available } ProcessResult result = FS.DETECTED.runHookIfPresent(getRepository(), getHookName(), getParameters(), getOutputStream(), hookErrRedirect, getStdinArgs()); if (result.isExecutedWithError()) { throw new AbortedByHookException( new String(errorByteArray.toByteArray(), UTF_8), getHookName(), result.getExitCode()); } }
/** * Whether the execution occurred and resulted in an error * * @return <code>true</code> if the execution occurred and resulted in a * return code different from 0, <code>false</code> otherwise. * @since 4.0 */ public boolean isExecutedWithError() { return getStatus() == ProcessResult.Status.OK && getExitCode() != 0; } }
/** * Runs the hook, without performing any validity checks. * * @throws org.eclipse.jgit.api.errors.AbortedByHookException * If the underlying hook script exited with non-zero. */ protected void doRun() throws AbortedByHookException { final ByteArrayOutputStream errorByteArray = new ByteArrayOutputStream(); PrintStream hookErrRedirect = null; try { hookErrRedirect = new PrintStream(errorByteArray, false, UTF_8.name()); } catch (UnsupportedEncodingException e) { // UTF-8 is guaranteed to be available } ProcessResult result = FS.DETECTED.runHookIfPresent(getRepository(), getHookName(), getParameters(), getOutputStream(), hookErrRedirect, getStdinArgs()); if (result.isExecutedWithError()) { throw new AbortedByHookException( new String(errorByteArray.toByteArray(), UTF_8), getHookName(), result.getExitCode()); } }
final File hookFile = findHook(repository, hookName); if (hookFile == null) return new ProcessResult(Status.NOT_PRESENT); return new ProcessResult(runProcess(hookProcess, outRedirect, errRedirect, stdinArgs), Status.OK); } catch (IOException e) {
/** * @return <code>true</code> if the execution occurred and resulted in a * return code different from 0, <code>false</code> otherwise. * @since 4.0 */ public boolean isExecutedWithError() { return getStatus() == ProcessResult.Status.OK && getExitCode() != 0; } }
/** * Runs the hook, without performing any validity checks. * * @throws AbortedByHookException * If the underlying hook script exited with non-zero. */ protected void doRun() throws AbortedByHookException { final ByteArrayOutputStream errorByteArray = new ByteArrayOutputStream(); final PrintStream hookErrRedirect = new PrintStream(errorByteArray); ProcessResult result = FS.DETECTED.runHookIfPresent(getRepository(), getHookName(), getParameters(), getOutputStream(), hookErrRedirect, getStdinArgs()); if (result.isExecutedWithError()) { throw new AbortedByHookException(errorByteArray.toString(), getHookName(), result.getExitCode()); } }
String[] args, PrintStream outRedirect, PrintStream errRedirect, String stdinArgs) throws JGitInternalException { return new ProcessResult(Status.NOT_SUPPORTED);
private void postCommitHook(final JGitFileSystem fileSystem) { ProcessResult result = detectedFS.runHookIfPresent(fileSystem.getGit().getRepository(), "post-commit", new String[0]); if(result.getStatus().equals(ProcessResult.Status.OK)) { fileSystem.notifyPostCommit(result.getExitCode()); } }
String[] args, PrintStream outRedirect, PrintStream errRedirect, String stdinArgs) throws JGitInternalException { return new ProcessResult(Status.NOT_SUPPORTED);
@Override public ProcessResult runHookIfPresent(Repository repox, String hookName, String[] args) throws JGitInternalException { if (hookName.equals(PostCommitHook.NAME)) { postCommitHookCalled.incrementAndGet(); return new ProcessResult(1, ProcessResult.Status.OK); } return new ProcessResult(ProcessResult.Status.NOT_PRESENT); } });
@Override public ProcessResult runHookIfPresent(Repository repox, String hookName, String[] args) throws JGitInternalException { if (hookName.equals(PostCommitHook.NAME)) { postCommitHookCalled.incrementAndGet(); return new ProcessResult(1, ProcessResult.Status.OK); } return new ProcessResult(ProcessResult.Status.NOT_PRESENT); } });
final File hookFile = findHook(repository, hookName); if (hookFile == null) return new ProcessResult(Status.NOT_PRESENT); hookProcess.directory(runDirectory); try { return new ProcessResult(runProcess(hookProcess, outRedirect, errRedirect, stdinArgs), Status.OK); } catch (IOException e) {
final File hookFile = findHook(repository, hookName); if (hookFile == null) return new ProcessResult(Status.NOT_PRESENT); return new ProcessResult(runProcess(hookProcess, outRedirect, errRedirect, stdinArgs), Status.OK); } catch (IOException e) {