diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-10-28 23:53:47 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-01-15 21:35:07 +0300 |
commit | a551843129dc4d329d4f7915a9c10120963acd7d (patch) | |
tree | 1b1cf74faaa641eb377a3d5a907ef19df923ccd7 /builtin | |
parent | 933bea922c202a7ff9b133a5cca4a805a7013aa2 (diff) |
grep: read -f file with strbuf_getline()
List of patterns file could come from a DOS editor.
This is iffy; you may actually be trying to find a line with ^M in
it on a system whose line ending is LF. You can of course work it
around by having a line that has "^M^M^J", let the strbuf_getline()
eat the last "^M^J", leaving just the single "^M" as the pattern.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/grep.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 5a5beb8109..801ce60e48 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -562,7 +562,7 @@ static int file_callback(const struct option *opt, const char *arg, int unset) patterns = from_stdin ? stdin : fopen(arg, "r"); if (!patterns) die_errno(_("cannot open '%s'"), arg); - while (strbuf_getline_lf(&sb, patterns) == 0) { + while (strbuf_getline(&sb, patterns) == 0) { /* ignore empty line like grep does */ if (sb.len == 0) continue; |