aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-12-28 18:13:35 +0100
committerAndrey Loskutov <loskutov@gmx.de>2015-12-29 02:33:23 +0100
commit4b7839cafd3561bbeca6ed6dabce3d9039ab8288 (patch)
tree2b054148a384b3412fefbc8ed6b816305d3faaf1 /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
parent241b50be319e29cfae2ab1a5fcec94e7931074f8 (diff)
downloadjgit-4b7839cafd3561bbeca6ed6dabce3d9039ab8288.tar.gz
jgit-4b7839cafd3561bbeca6ed6dabce3d9039ab8288.zip
Provide a root cause for aborted commands
Change-Id: Iafaa03dbacbe7f1b2b074d3294db988b08fdb0d7 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
index 56cfc7e8ef..40a42e5207 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
@@ -217,7 +217,7 @@ public abstract class TextBuiltin {
} catch (CmdLineException err) {
if (!help) {
this.errw.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
- throw die(true);
+ throw die(true, err);
}
}
@@ -324,6 +324,19 @@ public abstract class TextBuiltin {
return new Die(aborted);
}
+ /**
+ * @param aborted
+ * boolean indicating that the execution has been aborted before
+ * running
+ * @param cause
+ * why the command has failed.
+ * @return a runtime exception the caller is expected to throw
+ * @since 4.2
+ */
+ protected static Die die(boolean aborted, final Throwable cause) {
+ return new Die(aborted, cause);
+ }
+
String abbreviateRef(String dst, boolean abbreviateRemote) {
if (dst.startsWith(R_HEADS))
dst = dst.substring(R_HEADS.length());