Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grep: prevent
^$
false match at end of file
In some implementations, `regexec_buf()` assumes that it is fed lines; Without `REG_NOTEOL` it thinks the end of the buffer is the end of a line. Which makes sense, but trips up this case because we are not feeding lines, but rather a whole buffer. So the final newline is not the start of an empty line, but the true end of the buffer. This causes an interesting bug: $ echo content >file.txt $ git grep --no-index -n '^$' file.txt file.txt:2: This bug is fixed by making the end of the buffer consistently the end of the final line. The patch was applied from https://lore.kernel.org/git/[email protected]/ Reported-by: Olly Betts <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
- Loading branch information