From: Jonathan Nieder Date: Fri, 02 Jul 2010 19:21:02 GMT Subject: Re: [PATCH] Bugfix: grep: Do not colorize output when -O is set Message-ID: <20100702192102.GA6585@burratino> In-Reply-To: <1278064941-30689-1-git-send-email-ayiehere@gmail.com> Hi Nazri, Nazri Ramliy wrote: > When color.ui is set to auto, "git grep -Ovi foo" breaks due to the > presence of color escape sequences. I tried the following test without your patch, and it seemed to pass without trouble. What am I doing wrong? diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh index c110441..d47c054 100755 --- a/t/t7811-grep-open.sh +++ b/t/t7811-grep-open.sh @@ -125,6 +125,24 @@ test_expect_success 'modified file' ' test_cmp empty out ' +test_expect_success 'copes with color.ui' ' + rm -f actual && + echo grep.h >expect && + git config color.ui always && + test_when_finished "git config --unset color.ui" && + git grep -O'\''printf "%s\n" >actual'\'' GREP_AND && + test_cmp expect actual +' + +test_expect_success 'copes with color.grep' ' + rm -f actual && + echo grep.h >expect && + git config color.grep always && + test_when_finished "git config --unset color.grep" && + git grep -O'\''printf "%s\n" >actual'\'' GREP_AND && + test_cmp expect actual +' + test_expect_success 'run from subdir' ' rm -f actual && echo grep.c >expect &&