From: Eric Sunshine Date: Sat, 05 May 2018 07:36:12 GMT Subject: Re: [PATCH 2/2] builtin/grep.c: teach '-o', '--only-matching' to 'git-grep' Message-ID: In-Reply-To: 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 --heading git -- README.md | head -3 > README.md > 15:56:git > 18:20:git > > By using show_line_header(), 'git grep --only-matching' correctly > respects the '--header' option: What is the '--header' option? I don't see it used in any example. > $ git grep -on --column --heading git -- README.md | head -4 > README.md > 15:56:git > 18:20:git > 19:16:git How does this example differ from the earlier example (other than showing 4 lines of output rather than 3)? > Signed-off-by: Taylor Blau