aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-12-28 18:14:05 +0100
committerAndrey Loskutov <loskutov@gmx.de>2015-12-29 14:35:08 +0100
commitc1b31b3f3bcb445a36ee00035b3c17446073820d (patch)
tree27e0d52402cbe29a4500396251c47f1f35074b1b
parent888f08b048c213d3cbd8bb6a260d0924e82d65e1 (diff)
downloadjgit-c1b31b3f3bcb445a36ee00035b3c17446073820d.tar.gz
jgit-c1b31b3f3bcb445a36ee00035b3c17446073820d.zip
repo command: properly name the required 'path' argument
Fixes point 4 in bug 484951, where "jgit repo" or "jgit repo -h" dumps a stack trace. Bug: 484951 Change-Id: Ic8b362e07a40ad923dc9acde0c0983a1e7932a02 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java24
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java2
2 files changed, 25 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java
index 90efae286b..85fc1dbb4b 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java
@@ -42,10 +42,13 @@
*/
package org.eclipse.jgit.pgm;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
+import java.util.Arrays;
+
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.junit.JGitTestUtil;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
@@ -98,6 +101,27 @@ public class RepoTest extends CLIRepositoryTestCase {
}
@Test
+ public void testMissingPath() throws Exception {
+ assertEquals("fatal: Argument \"path\" is required",
+ execute("git repo")[0]);
+ }
+
+ /**
+ * See bug 484951: "git repo -h" should not print unexpected values
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testZombieHelpArgument() throws Exception {
+ String[] output = execute("git repo -h");
+ String all = Arrays.toString(output);
+ assertTrue("Unexpected help output: " + all,
+ all.contains("jgit repo"));
+ assertFalse("Unexpected help output: " + all,
+ all.contains("jgit repo VAL"));
+ }
+
+ @Test
public void testAddRepoManifest() throws Exception {
StringBuilder xmlContent = new StringBuilder();
xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java
index db88008e10..ea59527fed 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java
@@ -55,7 +55,7 @@ class Repo extends TextBuiltin {
@Option(name = "--groups", aliases = { "-g" }, usage = "usage_groups")
private String groups = "default"; //$NON-NLS-1$
- @Argument(required = true, usage = "usage_pathToXml")
+ @Argument(required = true, metaVar = "metaVar_path", usage = "usage_pathToXml")
private String path;
@Option(name = "--record-remote-branch", usage = "usage_branches")