diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java index 3f396563c..6a0a23380 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java @@ -218,7 +218,7 @@ else if (r.length() > 0) { inquote = !inquote; continue; case '\\': - if (inquote || ip == commandLine.length()) + if (inDblQuote || inquote || ip == commandLine.length()) r.append(b); // literal within a quote else r.append(commandLine.charAt(ip++)); diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CLIGitCommandTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CLIGitCommandTest.java index 24788a47b..58d8e0349 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CLIGitCommandTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CLIGitCommandTest.java @@ -51,9 +51,11 @@ public class CLIGitCommandTest { @Test public void testSplit() throws Exception { + assertArrayEquals(new String[0], split("")); assertArrayEquals(new String[] { "a" }, split("a")); assertArrayEquals(new String[] { "a", "b" }, split("a b")); assertArrayEquals(new String[] { "a", "b c" }, split("a 'b c'")); assertArrayEquals(new String[] { "a", "b c" }, split("a \"b c\"")); + assertArrayEquals(new String[] { "a", "b\\c" }, split("a \"b\\c\"")); } }