summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Neumann <Tim.Neumann@advantest.com>2019-11-28 12:56:12 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-12-09 00:55:09 +0100
commitd1bdfcd0a85d1092aee0230b282bba577c73fb4d (patch)
tree30d1c6a94154d925dda5bf294ed9d3bdd3bb9673
parent02dc0ca6888c101d9448b69b04ba9f03a0df2c33 (diff)
downloadjgit-d1bdfcd0a85d1092aee0230b282bba577c73fb4d.tar.gz
jgit-d1bdfcd0a85d1092aee0230b282bba577c73fb4d.zip
Add possibility to get pure stderr output from AbortedByHookException
This is a preparation for the corresponding EGit change to remove redundant output in the aborted by commit hook popup. Bug: 553469 Change-Id: Id5f39a4df659fafc9d951668e6f53fed4380de9d Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/errors/AbortedByHookException.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/AbortedByHookException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/AbortedByHookException.java
index db6440b55f..30a2d622a7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/AbortedByHookException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/AbortedByHookException.java
@@ -67,19 +67,26 @@ public class AbortedByHookException extends GitAPIException {
private final int returnCode;
/**
+ * The stderr output of the hook.
+ */
+ private final String hookStdErr;
+
+ /**
* Constructor for AbortedByHookException
*
- * @param message
- * The error details.
+ * @param hookStdErr
+ * The error details from the stderr output of the hook
* @param hookName
* The name of the hook that interrupted the command, must not be
* null.
* @param returnCode
* The return code of the hook process that has been run.
*/
- public AbortedByHookException(String message, String hookName,
+ public AbortedByHookException(String hookStdErr, String hookName,
int returnCode) {
- super(message);
+ super(MessageFormat.format(JGitText.get().commandRejectedByHook,
+ hookName, hookStdErr));
+ this.hookStdErr = hookStdErr;
this.hookName = hookName;
this.returnCode = returnCode;
}
@@ -102,10 +109,13 @@ public class AbortedByHookException extends GitAPIException {
return returnCode;
}
- /** {@inheritDoc} */
- @Override
- public String getMessage() {
- return MessageFormat.format(JGitText.get().commandRejectedByHook,
- hookName, super.getMessage());
+ /**
+ * Get the stderr output of the hook.
+ *
+ * @return A string containing the complete stderr output of the hook.
+ * @since 5.6
+ */
+ public String getHookStdErr() {
+ return hookStdErr;
}
}