From: Olly Betts <olly@survex.com>
To: git@vger.kernel.org
Subject: git grep: ^$ false match at end of file
Date: Thu, 9 Jan 2025 23:52:55 +0000 [thread overview]
Message-ID: <20250109235255.GA3418@survex.com> (raw)
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
next reply other threads:[~2025-01-10 0:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 23:52 Olly Betts [this message]
2025-01-10 11:43 ` git grep: ^$ false match at end of file Jeff King
2025-01-10 12:02 ` Jeff King
2025-01-10 12:59 ` Andreas Schwab
2025-01-13 6:26 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250109235255.GA3418@survex.com \
--to=olly@survex.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.