Re: [PATCH v7 1/2] grep: refactor next_match() and match_one_pattern() for external use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, Sep 23 2021 at 10:25:28 AM -0700, Junio C Hamano <gitster@xxxxxxxxx> wrote:
But how would the new caller that points "bol" at middle of a line
make sure that we are looking at the right kind of header?  If the
pattern p is set to match only for an author line, the first call
with "bol" set to the true beginning of the line will correctly
reject a "committer" header, but because you lost the sanity check
above, the second and subsequent one will go ahead and scan for the
pattern p on the line, even if p->field asks for author line and the
line records the committer.  You'd end up finding a commit object
that is committed by (but not authored by) the person when you are
looking for a commit that was authored by somebody, no?

If you ask for commits by somebody (e.g. "--author=Hazma") with an
output format that shows both the author and the committer
(e.g. "log --pretty=fuller"), wouldn't your "hit coloring" code
show Hazma on the committer name as a grep hit, too?

Actually, this issue doesn't arise because I filter away the irrelevant
(header) patterns in grep_next_match(). However, maybe it's a better idea
to handle that in match_one_pattern().





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux