diff options
| author | Patrick Steinhardt <ps@pks.im> | 2019-06-07 11:12:54 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2019-06-13 11:03:46 +0200 |
| commit | b3b6a39d928cf4ecda54468cc5029013363654d7 (patch) | |
| tree | 653bccaae832563b9e8d1d50e14fd02bf54a3678 /tests/ignore/path.c | |
| parent | 10ac298c62b40a205e771f50f9171c900c0e50dd (diff) | |
| download | libgit2-b3b6a39d928cf4ecda54468cc5029013363654d7.tar.gz | |
attr_file: account for escaped escapes when searching trailing space
When determining the trailing space length, we need to honor
whether spaces are escaped or not. Currently, we do not check
whether the escape itself is escaped, though, which might
generate an off-by-one in that case as we will simply treat the
space as escaped.
Fix this by checking whether the backslashes preceding the space
are themselves escaped.
Diffstat (limited to 'tests/ignore/path.c')
| -rw-r--r-- | tests/ignore/path.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ignore/path.c b/tests/ignore/path.c index 0c22582ac..bfed297c2 100644 --- a/tests/ignore/path.c +++ b/tests/ignore/path.c @@ -521,3 +521,20 @@ void test_ignore_path__escaped_slash(void) assert_is_ignored(true, "inter\\mittent"); assert_is_ignored(true, "trailing\\"); } + +void test_ignore_path__escaped_space(void) +{ + cl_git_rewritefile( + "attr/.gitignore", + "foo\\\\ \n" + "bar\\\\\\ \n"); + assert_is_ignored(true, "foo\\"); + assert_is_ignored(false, "foo\\ "); + assert_is_ignored(false, "foo\\\\ "); + assert_is_ignored(false, "foo\\\\"); + assert_is_ignored(true, "bar\\ "); + assert_is_ignored(false, "bar\\\\"); + assert_is_ignored(false, "bar\\\\ "); + assert_is_ignored(false, "bar\\\\\\"); + assert_is_ignored(false, "bar\\\\\\ "); +} |
