summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
index 335cada7a3..884f49845c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
@@ -834,9 +834,15 @@ public class Config {
out.append(e.section);
if (e.subsection != null) {
out.append(' ');
- out.append('"');
- out.append(escapeValue(e.subsection));
- out.append('"');
+ String escaped = escapeValue(e.subsection);
+ // make sure to avoid double quotes here
+ boolean quoted = escaped.startsWith("\"")
+ && escaped.endsWith("\"");
+ if (!quoted)
+ out.append('"');
+ out.append(escaped);
+ if (!quoted)
+ out.append('"');
}
out.append(']');
} else if (e.section != null && e.name != null) {