Re: [PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep'

2018-05-09 Thread Jeff King
On Wed, May 09, 2018 at 07:00:10PM -0700, Taylor Blau wrote: > > - they test with context (-C3) for us. It looks like GNU grep omits > >context lines with "-o", but we show a bunch of blank lines. This is > >I guess a bug (though it seems kind of an odd combination to specify > >in th

Re: [PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep'

2018-05-09 Thread Taylor Blau
On Tue, May 08, 2018 at 01:25:17PM -0400, Jeff King wrote: > On Sat, May 05, 2018 at 08:49:43AM +0200, Ævar Arnfjörð Bjarmason wrote: > > > > +test_expect_success 'grep --only-matching --heading' ' > > > + git grep --only-matching --heading --line-number --column mmap file > > > >actual && > > > +

Re: [PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep'

2018-05-08 Thread Jeff King
On Sat, May 05, 2018 at 08:49:43AM +0200, Ævar Arnfjörð Bjarmason wrote: > > +test_expect_success 'grep --only-matching --heading' ' > > + git grep --only-matching --heading --line-number --column mmap file > > >actual && > > + test_cmp expected actual > > +' > > + > > cat >expected < > hel

Re: [PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep'

2018-05-07 Thread Taylor Blau
On Sat, May 05, 2018 at 03:36:12AM -0400, Eric Sunshine wrote: > On Sat, May 5, 2018 at 12:03 AM, Taylor Blau wrote: > > Teach GNU grep(1)'s '-o' ('--only-matching') to 'git-grep'. This option > > prints only the matching components of each line. It writes multiple > > lines if more than one match

Re: [PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep'

2018-05-05 Thread Eric Sunshine
On Sat, May 5, 2018 at 12:03 AM, Taylor Blau wrote: > Teach GNU grep(1)'s '-o' ('--only-matching') to 'git-grep'. This option > prints only the matching components of each line. It writes multiple > lines if more than one match exists on a given line. > > For example: > > $ git grep -on --column

Re: [PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep'

2018-05-04 Thread Ævar Arnfjörð Bjarmason
On Sat, May 05 2018, Taylor Blau wrote: > +--o:: > +--only-matching:: > + Show only the matching part of the lines. > + Makes sense to steal GNU grep's description here: Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line. > +

[PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep'

2018-05-04 Thread Taylor Blau
Teach GNU grep(1)'s '-o' ('--only-matching') to 'git-grep'. This option prints only the matching components of each line. It writes multiple lines if more than one match exists on a given line. For example: $ git grep -on --column --heading git -- README.md | head -3 README.md 15:56:git 1