aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java
index 8569e9278e..f5de7045d0 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java
@@ -42,9 +42,9 @@ import java.io.IOException;
import java.util.Set;
import org.eclipse.jgit.errors.ConfigInvalidException;
-import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.StoredConfig;
+import org.eclipse.jgit.pgm.internal.CLIText;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.StringUtils;
@@ -69,12 +69,15 @@ class Config extends TextBuiltin {
private File configFile;
@Override
- protected void run() throws Exception {
- if (list)
+ protected void run() {
+ if (!list) {
+ throw die(CLIText.get().configOnlyListOptionSupported);
+ }
+ try {
list();
- else
- throw new NotSupportedException(
- "only --list option is currently supported");
+ } catch (IOException | ConfigInvalidException e) {
+ throw die(e.getMessage(), e);
+ }
}
private void list() throws IOException, ConfigInvalidException {
@@ -91,7 +94,7 @@ class Config extends TextBuiltin {
if (global || isListAll())
list(SystemReader.getInstance().openUserConfig(null, fs));
if (local || isListAll())
- list(new FileBasedConfig(fs.resolve(getRepository().getDirectory(),
+ list(new FileBasedConfig(fs.resolve(getRepository().getCommonDirectory(),
Constants.CONFIG), fs));
}
@@ -122,4 +125,4 @@ class Config extends TextBuiltin {
}
}
}
-} \ No newline at end of file
+}