summaryrefslogtreecommitdiff
path: root/tests/config/read.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-04-20 00:22:20 -0400
committerEdward Thomson <ethomson@microsoft.com>2015-04-20 00:26:00 -0400
commite009a7059d69173113122eb2d28de8a03083b201 (patch)
tree444f2a2e8815867e3bd2002f2c1114014fa085e0 /tests/config/read.c
parent7f2e61f3ee5a15b7232a898f2464fbd7cc23aef2 (diff)
downloadlibgit2-e009a7059d69173113122eb2d28de8a03083b201.tar.gz
config_file: comment char can be invalid escape
Don't assume that comment chars are comment chars, they may be (an attempt to be escaped). If so, \; is not a valid escape sequence, complain.
Diffstat (limited to 'tests/config/read.c')
-rw-r--r--tests/config/read.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/config/read.c b/tests/config/read.c
index f20a3769f..a19bc7dcb 100644
--- a/tests/config/read.c
+++ b/tests/config/read.c
@@ -247,6 +247,17 @@ void test_config_read__escaping_quotes(void)
git_config_free(cfg);
}
+void test_config_read__invalid_escape_sequence(void)
+{
+ git_config *cfg;
+
+ cl_set_cleanup(&clean_test_config, NULL);
+ cl_git_mkfile("./testconfig", "[header]\n key1 = \\\\\\;\n key2 = value2\n");
+ cl_git_fail(git_config_open_ondisk(&cfg, "./testconfig"));
+
+ git_config_free(cfg);
+}
+
static int count_cfg_entries_and_compare_levels(
const git_config_entry *entry, void *payload)
{