summaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-01-11 06:10:55 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-11 12:51:28 -0800
commit7675c7bd01b8d39dc3c1e8385403f0307be31712 (patch)
treee0f62ac0c3721509046866f6d7d5391e40f8ed32 /ref-filter.c
parentGit 2.8.4 (diff)
downloadtgif-7675c7bd01b8d39dc3c1e8385403f0307be31712.tar.xz
t7810: avoid assumption about invalid regex syntax
A few of the tests want to check that "git grep -P -E" will override -P with -E, and vice versa. To do so, we use a regex with "\x{..}", which is valid in PCRE but not defined by POSIX (for basic or extended regular expressions). However, POSIX declares quite a lot of syntax, including "\x", as "undefined". That leaves implementations free to extend the standard if they choose. At least one, musl libc, implements "\x" in the same way as PCRE. Our tests check that "-E" complains about "\x", which fails with musl. We can fix this by finding some construct which behaves reliably on both PCRE and POSIX, but differently in each system. One such construct is the use of backslash inside brackets. In PCRE, "[\d]" interprets "\d" as it would outside the brackets, matching a digit. Whereas in POSIX, the backslash must be treated literally, and we match either it or a literal "d". Moreover, implementations are not free to change this according to POSIX, so we should be able to rely on it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.c')
0 files changed, 0 insertions, 0 deletions