git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Avoid false positives in label detection in cpp diff hunk header regex.

From
VZVadim Zeitlin <vz-git@zeitlins.org>
Date
Mar 22, 2013, 17:27 UTC
Message-ID
<loom.20130322T182517-342@post.gmane.org>
In-Reply-To
<7vehf78olw.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster <at> pobox.com> writes:
> 
> Vadim Zeitlin <vz-git <at> zeitlins.org> writes:
... 
Show 17 quoted lines
> > diff --git a/userdiff.c b/userdiff.c
> > index ea43a03..9415586 100644
> > --- a/userdiff.c
> > +++ b/userdiff.c
> > @@ -125,7 +125,7 @@ PATTERNS("tex",
> > "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
> >          "\\\\[a-zA-Z@]+|\\\\.|[a-zA-Z0-9\x80-\xff]+"),
> >  PATTERNS("cpp",
> >          /* Jump targets or access declarations */
> > -        "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:.*$\n"
> > +        "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:([^:].*$|$)\n"
> 
> Hmm.  Wouldn't "find a word (possibly after indentation), colon and
> then either a non-colon or end of line" be sufficient and simpler?
> iow, something like...
> 
>        "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:([^:]|$)"
 This works too, of course. I didn't know why did the original regex
contain ".*$" part so I decided to keep it but your version is indeed
how I would have written it myself if I were doing it from scratch.
 Should I resubmit an updated patch or could you please just apply
your version?
 TIA!
VZ
Previous: Junio C HamanoNext: Johannes Sixt
Message 3 of 9 in “Avoid false positives in label detection in cpp diff hunk header regex.”
  1. Avoid false positives in label detection in cpp diff hunk header regex.Vadim Zeitlin, Mar 22, 2013
  2. Junio C HamanoMar 22, 2013
  3. Vadim ZeitlinMar 22, 2013
  4. Johannes SixtMar 22, 2013
  5. Junio C HamanoMar 22, 2013
  6. Johannes SixtMar 22, 2013
  7. Vadim ZeitlinMar 23, 2013
  8. Andreas SchwabMar 23, 2013
  9. Vadim ZeitlinMar 23, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.