git grep: ^$ false match at end of file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git grep '^$' seems to match at the end of the file, reporting a line
number one greater than the number of lines in that file.  This does
not match the behaviour of grep.

To reproduce:

$ git init -q git-grep-bug
$ cd git-grep-bug
$ echo test > test.txt
$ git add test.txt
$ git commit -m test
[master (root-commit) 55b48b26] test
 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
$ git grep -n '^$'
test.txt:2:
$ grep -n '^$' test.txt
$

(The -n option isn't required to trigger it.)

I'm using the git 1:2.47.1-1 packages from Debian unstable.  I can also
reproduce with git 1:2.48.0~rc1+next.20250101-1 from Debian
experimental.

Cheers,
    Olly




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux