Subject: Re: [PATCH v2 0/6] Teach '--column-number' to 'git-grep(1)'

From: Taylor Blau <[email-masked]>
Date: Sun, 22 Apr 2018 16:34:03 -0700

On Mon, Apr 23, 2018 at 08:28:14AM +0900, Junio C Hamano wrote:
> Taylor Blau <[email-masked]> writes:
>
> > diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
> > index 0cf654824d..7349c7fadc 100755
> > --- a/t/t7810-grep.sh
> > +++ b/t/t7810-grep.sh
> > @@ -106,7 +106,7 @@ do
> >  			echo ${HC}file:5:foo mmap bar_mmap
> >  			echo ${HC}file:14:foo_mmap bar mmap baz
> >  		} >expected &&
> > -		git -c grep.linenumber=false grep -m -w -e mmap $H >actual &&
> > +		git grep --column-number -w -e mmap $H >actual &&
> >  		test_cmp expected actual
> >  	'
> >
> > @@ -117,7 +117,7 @@ do
> >  			echo ${HC}file:4:5:foo mmap bar_mmap
> >  			echo ${HC}file:5:14:foo_mmap bar mmap baz
> >  		} >expected &&
> > -		git -c grep.linenumber=false grep -n -m -w -e mmap $H >actual &&
> > +		git grep -n --column-number -w -e mmap $H >actual &&
> >  		test_cmp expected actual
> >  	'
>
> It seems that these two used to be "even when it is configured not
> to show linenumber, with -n it is shown and without -n it is not,
> when the new --column-number feature forces the command to show the
> "filename plus colon plus location info plus coon" header.  I'm
> guessing that the reason why these got changed this round is because
> the old way was found too defensive (perhaps nobody sets
> grep.linenumber in .git/config in the tests that come before these)?

Sort of. My aim with these new tests is to ensure that git-grep(1) works
with:

  - '--line-number'
  - '--column-number'
  - '--line-number' and '--column-number' together

It seemed unrelated to be testing the various permutations of
grep.linenumber and --line-number along with the above three so I
removed these in order to focus only on the above three.

Do you think that it is worth testing --column-number with and without
grep.columnnumber as above?

Thanks,
Taylor