Documentation/git-reset: reorder modes for soft-mixed-hard progression
[gitweb.git] / builtin / grep.c
index 4b8ddbe0d52d3aa9719372400c24959dc7efd8c2..597f76bc42f51e0fc1906c287981e3d37dc0f536 100644 (file)
@@ -770,11 +770,15 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
        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);
@@ -997,6 +1001,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        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;