summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-01-20 21:49:21 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-01-21 00:54:15 +0100
commit6c847b30c0e81e44374fc0d00a235560620de5ce (patch)
tree69bd23a27b8d98e6518e167b3dc2173904dd3e95 /org.eclipse.jgit.pgm
parentd614ba3334651310b32147ea383675f13aef72c0 (diff)
downloadjgit-6c847b30c0e81e44374fc0d00a235560620de5ce.tar.gz
jgit-6c847b30c0e81e44374fc0d00a235560620de5ce.zip
pgm: Handle IOException in MergeBase command
This avoids we show a stacktrace on the console by default when this type of exception is thrown during the run method is executed. Change-Id: I5f198f71adfbb43ec1af26285658a5d5bdfa1904 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java
index 6842d8ddbf..22d33582f5 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.pgm;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -67,16 +68,20 @@ class MergeBase extends TextBuiltin {
/** {@inheritDoc} */
@Override
- protected void run() throws Exception {
- for (RevCommit c : commits)
- argWalk.markStart(c);
- argWalk.setRevFilter(RevFilter.MERGE_BASE);
- int max = all ? Integer.MAX_VALUE : 1;
- while (max-- > 0) {
- final RevCommit b = argWalk.next();
- if (b == null)
- break;
- outw.println(b.getId().name());
+ protected void run() {
+ try {
+ for (RevCommit c : commits)
+ argWalk.markStart(c);
+ argWalk.setRevFilter(RevFilter.MERGE_BASE);
+ int max = all ? Integer.MAX_VALUE : 1;
+ while (max-- > 0) {
+ final RevCommit b = argWalk.next();
+ if (b == null)
+ break;
+ outw.println(b.getId().name());
+ }
+ } catch (IOException e) {
+ throw die(e.getMessage(), e);
}
}
}