]> Lady’s Gitweb - Gitweb/commit
gitweb: Harden "grep" search against filenames with ':'
authorJakub Narebski <redacted>
Thu, 5 Jan 2012 20:32:56 +0000 (21:32 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:31 +0000 (00:51 -0400)
commit040854b07fdfb25490cb6923c136a5c6612780766a9fd56a9161690aff047a30
treec618e34c1acd451811bf9d8cc7aef065d3b4925f215bcb9648a5395ac69f053f
parent860386bfb01a1d9c04d867d95868f3f15cb43acfacdb2ae7d262f2ca7228de89
gitweb: Harden "grep" search against filenames with ':'

Run "git grep" in "grep" search with '-z' option, to be able to parse
response also for files with filename containing ':' character.  The
':' character is otherwise (without '-z') used to separate filename
from line number and from matched line.

Note that this does not protect files with filename containing
embedded newline.  This would be hard but doable for text files, and
harder or even currently impossible with binary files: git does not
quote filename in

  "Binary file <foo> matches"

message, but new `--break` and/or `--header` options to git-grep could
help here.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.089801 seconds and 4 git commands to generate.