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>
This commit is contained in:
parent
888f08b048
commit
c1b31b3f3b
|
@ -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;
|
||||
|
@ -97,6 +100,27 @@ public void setUp() throws Exception {
|
|||
resolveRelativeUris();
|
||||
}
|
||||
|
||||
@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();
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue