From 52e011cd2b13e00fe40b1d59986948330b61e030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 12 Apr 2021 19:15:21 +0200 Subject: pickaxe -S: support content with NULs under --pickaxe-regex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a bug in the matching routine powering -S --pickaxe-regex so that we won't abort early on content that has NULs in it. We've had a hard requirement on REG_STARTEND since 2f8952250a8 (regex: add regexec_buf() that can work on a non NUL-terminated string, 2016-09-21), but this sanity check dates back to d01d8c67828 (Support for pickaxe matching regular expressions, 2006-03-29). It wasn't needed anymore, and as the now-passing test shows, actively getting in our way. Since we always require REG_STARTEND support we do not need to stop at NULs. If we are dealing with a haystack with NUL in it. The needle may be behind that NUL. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t4209-log-pickaxe.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/t4209-log-pickaxe.sh') diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh index 3f9aad0fdb..75795d0b49 100755 --- a/t/t4209-log-pickaxe.sh +++ b/t/t4209-log-pickaxe.sh @@ -215,4 +215,12 @@ test_expect_success 'log -S looks into binary files' ' test_cmp log full-log ' +test_expect_success 'log -S --pickaxe-regex looks into binary files' ' + git -C GS-bin-txt log --pickaxe-regex -Sa >log && + test_cmp log full-log && + + git -C GS-bin-txt log --pickaxe-regex -S"[a]" >log && + test_cmp log full-log +' + test_done -- cgit v1.2.3