From 5fe455c84f25eda70094b75f23251a2e8d525594 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Wed, 24 Jul 2019 20:36:51 +0200 Subject: JGit pgm tests must quote paths on the command line The JGit pgm tests parse the command line internally using Linux semantics, treating '\' as an escape. File paths therefore must be quoted, otherwise Windows paths are destroyed. See the attachment[1] on bug 548598. [1] https://bugs.eclipse.org/bugs/attachment.cgi?id=279387 Bug: 544326 Change-Id: If42e29c8e808b0983fba2843a34c3ea3dd0e9246 Signed-off-by: Thomas Wolf --- .../src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'org.eclipse.jgit.pgm.test/src') diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java index a830ff2849..befb7f62ac 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java @@ -211,6 +211,14 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase { .replaceAll("\t", "\\\\t"); } + protected String shellQuote(String s) { + return "'" + s.replace("'", "'\\''") + "'"; + } + + protected String shellQuote(File f) { + return "'" + f.getPath().replace("'", "'\\''") + "'"; + } + protected void assertStringArrayEquals(String expected, String[] actual) { // if there is more than one line, ignore last one if empty assertEquals(1, -- cgit v1.2.3