author | Jakub Narebski <jnareb@gmail.com> | |
Thu, 5 Jan 2012 20:32:56 +0000 (21:32 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 5 Jan 2012 21:29:51 +0000 (13:29 -0800) | ||
commit | 8e09fd1a1e5ea8eaec960d47be51bde85df8870e | |
tree | 126a0cdb8c40bc78fd2c36f26bf4808e9154bb81 | tree | snapshot |
parent | ff7f2185d6e04b7bea66f39ee51d79919ab1279c | commit | diff |
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 <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl | diff | blob | history |