All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hamza Mahfooz <someguy@effective-light.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH v7 1/2] grep: refactor next_match() and match_one_pattern() for external use
Date: Fri, 24 Sep 2021 08:04:29 -0400	[thread overview]
Message-ID: <HJTXZQ.ONLOCDR1B7O51@effective-light.com> (raw)
In-Reply-To: <xmqq8rzn2ohj.fsf@gitster.g>


On Thu, Sep 23 2021 at 10:25:28 AM -0700, Junio C Hamano 
<gitster@pobox.com> 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().



      reply	other threads:[~2021-09-24 12:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 21:13 [PATCH v7 1/2] grep: refactor next_match() and match_one_pattern() for external use Hamza Mahfooz
2021-09-21 21:13 ` [PATCH v7 2/2] pretty: colorize pattern matches in commit messages Hamza Mahfooz
2021-09-23 17:25 ` [PATCH v7 1/2] grep: refactor next_match() and match_one_pattern() for external use Junio C Hamano
2021-09-24 12:04   ` Hamza Mahfooz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=HJTXZQ.ONLOCDR1B7O51@effective-light.com \
    --to=someguy@effective-light.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.