Merge branch 'jn/grep-open'
authorJunio C Hamano <gitster@pobox.com>
Thu, 15 Jul 2010 19:07:18 +0000 (12:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Jul 2010 19:07:18 +0000 (12:07 -0700)
* jn/grep-open:
grep -O: Do not pass color sequences as filenames to pager

1  2 
builtin/grep.c
diff --combined builtin/grep.c
index 232cd1ce07bf3f695c722e6217ce653ff704d64b,7a9427d357cf54e02f7f251a509911a7e4a6c936..597f76bc42f51e0fc1906c287981e3d37dc0f536
@@@ -770,15 -770,11 +770,15 @@@ static int file_callback(const struct o
        if (!patterns)
                die_errno("cannot open '%s'", arg);
        while (strbuf_getline(&sb, patterns, '\n') == 0) {
 +              char *s;
 +              size_t len;
 +
                /* ignore empty line like grep does */
                if (sb.len == 0)
                        continue;
 -              append_grep_pattern(grep_opt, strbuf_detach(&sb, NULL), arg,
 -                                  ++lno, GREP_PATTERN);
 +
 +              s = strbuf_detach(&sb, &len);
 +              append_grep_pat(grep_opt, s, len, arg, ++lno, GREP_PATTERN);
        }
        fclose(patterns);
        strbuf_release(&sb);
@@@ -1001,6 -997,7 +1001,7 @@@ int cmd_grep(int argc, const char **arg
        if (show_in_pager == default_pager)
                show_in_pager = git_pager(1);
        if (show_in_pager) {
+               opt.color = 0;
                opt.name_only = 1;
                opt.null_following_name = 1;
                opt.output_priv = &path_list;