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

Re: [PATCH] split_ident: parse timestamp from end of line

From
Jeff King <peff@peff.net>
Date
Oct 14, 2013, 23:29 UTC
Message-ID
<20131014232949.GA10415@sigill.intra.peff.net>
In-Reply-To
<xmqqsiw3eajt.fsf@gitster.dls.corp.google.com>
On Mon, Oct 14, 2013 at 03:45:42PM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Yeah, you are right[1]. I'm happy to re-roll. I wonder if we even need
> > to worry about a compatibility wrapper. We are already doing pointer
> > manipulations, and it is probably just as readable to roll the loop by
> > hand.
> 
> Yeah, unrolling the loop is probably better.  You may even be able
> to do so in a single pass with an extra "last > seen" pointer
> variable without too much additional code complexity, I would think.
I'm not sure what you mean here.

If you mean doing a single pass to find the final ">", that is easy, because we know the length of the line already and can jump past and start from the back.

If you mean rolling it into the loop directly below, where we jump past the whitespace, I think it's a bit more complicated. We would not want to stop when we see something date-like, because parsing:

  Name <<bogus.email> 5678> 1234 -0500

you would want to find "1234" as the date. You can, while you are scanning right, keep track of the end of the whitespace after ">", but I do not think the complication is worth much. There should typically only be one space, so you are only saving looking at a single character.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 9 in “split_ident: parse timestamp from end of line”
  1. split_ident: parse timestamp from end of lineJeff King, Oct 14, 2013
  2. Junio C HamanoOct 14, 2013
  3. Jeff KingOct 14, 2013
  4. Jeff KingOct 14, 2013
  5. Junio C HamanoOct 14, 2013
  6. Jeff KingOct 14, 2013
  7. Junio C HamanoOct 15, 2013
  8. Jeff KingOct 15, 2013
  9. Junio C HamanoOct 15, 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.