aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2022-01-31 08:58:17 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2022-02-01 00:05:52 +0100
commit0588dd0a9f7a86a7a854da444a9a27d2eabb2a66 (patch)
tree4c8aa00247a4af8b6fe59509b9cb63aa59a2f5a6 /org.eclipse.jgit.test/tst
parent961d5e68759afba0615a5f679233ee2e4af2d278 (diff)
downloadjgit-0588dd0a9f7a86a7a854da444a9a27d2eabb2a66.tar.gz
jgit-0588dd0a9f7a86a7a854da444a9a27d2eabb2a66.zip
[test] Fix ConfigTest for Windows
Escape paths when writing them to a config file to ensure they work with backslashes and unusual characters. Bug: 550111 Change-Id: Iedc5c0f2c0c02ac6cadf43cdae0f0d19578aed91 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
index 9b82c2afd6..a85a4f49b6 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
@@ -1488,7 +1488,8 @@ public class ConfigTest {
String expectedTemplatePath = tempFile.getPath();
Config config = parse(
- "[commit]\n\ttemplate = " + expectedTemplatePath + "\n");
+ "[commit]\n\ttemplate = "
+ + Config.escapeValue(expectedTemplatePath) + "\n");
String templatePath = config.get(CommitConfig.KEY)
.getCommitTemplatePath();
@@ -1537,7 +1538,8 @@ public class ConfigTest {
JGitTestUtil.write(tempFile, templateContent);
String expectedTemplatePath = tempFile.getPath();
config = parse("[i18n]\n\tcommitEncoding = utf-8\n"
- + "[commit]\n\ttemplate = " + expectedTemplatePath + "\n");
+ + "[commit]\n\ttemplate = "
+ + Config.escapeValue(expectedTemplatePath) + "\n");
assertEquals(templateContent,
config.get(CommitConfig.KEY).getCommitTemplateContent(repo));
String commitEncoding = config.get(CommitConfig.KEY)
@@ -1556,7 +1558,8 @@ public class ConfigTest {
String templateContent = "content of the template";
JGitTestUtil.write(tempFile, templateContent);
config = parse("[i18n]\n\tcommitEncoding = invalidEcoding\n"
- + "[commit]\n\ttemplate = " + tempFile.getPath() + "\n");
+ + "[commit]\n\ttemplate = "
+ + Config.escapeValue(tempFile.getPath()) + "\n");
config.get(CommitConfig.KEY).getCommitTemplateContent(repo);
}
@@ -1570,7 +1573,7 @@ public class ConfigTest {
String templateContent = "content of the template";
JGitTestUtil.write(tempFile, templateContent);
// commit message encoding
- String expectedTemplatePath = "/nonExistingTemplate";
+ String expectedTemplatePath = "~/nonExistingTemplate";
config = parse("[commit]\n\ttemplate = " + expectedTemplatePath + "\n");
String templatePath = config.get(CommitConfig.KEY)
.getCommitTemplatePath();