git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Bugfix: grep: Do not colorize output when -O is set

From
Nazri Ramliy <ayiehere@gmail.com>
Date
Jul 2, 2010, 10:02 UTC
Message-ID
<1278064941-30689-1-git-send-email-ayiehere@gmail.com>

When color.ui is set to auto, "git grep -Ovi foo" breaks due to the presence of color escape sequences.

Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
---
Breakage aside, 'git grep -Ovi' really rocks!
 builtin/grep.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 232cd1c..597f76b 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1001,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;
-- 
1.7.1.245.g7c42e.dirty
Next: René Scharfe
Message 1 of 11 in “Bugfix: grep: Do not colorize output when -O is set”
  1. Bugfix: grep: Do not colorize output when -O is setNazri Ramliy, Jul 2, 2010
  2. René ScharfeJul 2, 2010
  3. Jonathan NiederJul 6, 2010
  4. René ScharfeJul 6, 2010
  5. Jonathan NiederJul 2, 2010
  6. Nazri RamliyJul 3, 2010
  7. grep -O: Do not pass color sequences as filenames to pagerJonathan Nieder, Jul 3, 2010
  8. Jakub NarebskiJul 3, 2010
  9. t/README: document more test helpersJonathan Nieder, Jul 6, 2010
  10. Ævar Arnfjörð BjarmasonJul 6, 2010
  11. Junio C HamanoJul 7, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.