aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2017-12-21 08:55:45 -0500
committerDave Borowitz <dborowitz@google.com>2017-12-21 09:30:52 -0500
commitbe224f8d4c6afb9603c4f824e91e639c9f99cc7a (patch)
tree41b8bab0adfd71523c07b1e621539a868e482548 /org.eclipse.jgit/src/org/eclipse/jgit/lib
parentfa24425c608e0983580fa81743de9cfda9faac2e (diff)
downloadjgit-be224f8d4c6afb9603c4f824e91e639c9f99cc7a.tar.gz
jgit-be224f8d4c6afb9603c4f824e91e639c9f99cc7a.zip
Config: Drop backslash in invalid escape sequences in subsections
These are ignored by C git when parsing: $ git config -f - --list <<EOF [foo "x\0y"] bar = baz [foo "x\qy"] bar = baz [foo "x\by"] bar = baz [foo "x\ny"] bar = baz [foo "x\ty"] bar = baz EOF foo.x0y.bar=baz foo.xqy.bar=baz foo.xby.bar=baz foo.xny.bar=baz foo.xty.bar=baz This behavior is different from value parsing, where an invalid escape sequence is an error (which JGit already does as well): $ git config -f - --list <<EOF [foo] bar = x\qy EOF fatal: bad config line 2 in standard input Change-Id: Ifd40129b37d9a62df3d886d8d7e22f766f54e9d1
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java7
1 files changed, 4 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 f46b7f37a8..a6313f0cc5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
@@ -1315,9 +1315,10 @@ public class Config {
continue;
default:
- throw new ConfigInvalidException(MessageFormat.format(
- JGitText.get().badEscape,
- Character.valueOf(((char) c))));
+ // C git simply drops backslashes if the escape sequence is not
+ // recognized.
+ r.append((char) c);
+ continue;
}
}
if ('"' == c) {