aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-01-20 21:32:21 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-01-21 00:54:14 +0100
commit1978f180a213c6b6ad6cab95e1606a229889e08c (patch)
tree1138a8d72fc7fcd5becb2124dc761348b2aa3b96 /org.eclipse.jgit.pgm/src
parent5739d1b314c8015149936dae83d29cb7ef2e7266 (diff)
downloadjgit-1978f180a213c6b6ad6cab95e1606a229889e08c.tar.gz
jgit-1978f180a213c6b6ad6cab95e1606a229889e08c.zip
pgm: Handle exceptions in LsFiles 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: I7d71e194f0a7e4180094a9b36dbb55dd90c9722e
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsFiles.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsFiles.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsFiles.java
index dc13000d63..ef25844973 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsFiles.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsFiles.java
@@ -48,11 +48,13 @@ import static org.eclipse.jgit.lib.FileMode.GITLINK;
import static org.eclipse.jgit.lib.FileMode.REGULAR_FILE;
import static org.eclipse.jgit.lib.FileMode.SYMLINK;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.jgit.dircache.DirCacheIterator;
+import org.eclipse.jgit.errors.RevisionSyntaxException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
@@ -72,7 +74,7 @@ class LsFiles extends TextBuiltin {
private List<String> paths = new ArrayList<>();
@Override
- protected void run() throws Exception {
+ protected void run() {
try (RevWalk rw = new RevWalk(db);
TreeWalk tw = new TreeWalk(db)) {
final ObjectId head = db.resolve(Constants.HEAD);
@@ -96,6 +98,8 @@ class LsFiles extends TextBuiltin {
QuotedString.GIT_PATH.quote(tw.getPathString()));
}
}
+ } catch (RevisionSyntaxException | IOException e) {
+ throw die(e.getMessage(), e);
}
}