Commit 7da1a07
grep: prevent
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]>^$ false match at end of file1 parent bea00e6 commit 7da1a07
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1646 | 1646 | | |
1647 | 1647 | | |
1648 | 1648 | | |
| 1649 | + | |
| 1650 | + | |
1649 | 1651 | | |
1650 | 1652 | | |
1651 | 1653 | | |
| |||
0 commit comments