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

Re: [PATCH] t1500: ensure current --since= behavior remains

From
EWEric Wong <e@80x24.org>
Date
Feb 11, 2021, 17:06 UTC
Message-ID
<20210211170625.GA8280@dcvr>
In-Reply-To
<YCUSaXCg8Abg+vGs@coredump.intra.peff.net>
Jeff King <peff@peff.net> wrote:
Show 18 quoted lines
> On Wed, Feb 10, 2021 at 09:55:43PM +0000, Eric Wong wrote:
> 
> > This behavior of git-rev-parse is observed since git 1.8.3.1
> > at least(*), and likely earlier versions.
> > 
> > At least one git-reliant project in-the-wild relies on this
> > current behavior of git-rev-parse being able to handle multiple
> > --since= arguments without squeezing identical results together.
> > So add a test to prevent the potential for regression in
> > downstream projects.
> 
> I had to read this a few times to understand what "this behavior" meant.
> It is just: when given multiple --since options, output a --max-age for
> each of them, even though internally, Git's revision traversal will only
> use one (in the usual last-one-wins fashion).
> 
> I'm not sure if I was just being dense, or if this could be spelled out
> more clearly. :)

*shrug* :> My brain struggles with coherent thought so I'm surprised anybody is able to understand me at all :x

Show 5 quoted lines
> Out of curiosity, why does the other project want that? From your
> mention of libgit2's git__date_parse(), I assume it's something that
> wants to parse approxidates into timestamps in a script. Maybe we ought
> to provide a more direct and robust way of doing that. We have a similar
> need in t0006, but we use a test-helper program for it.

It takes about 5ms for my system to run git-rev-parse once. I may be getting multiple approxidates at once, 1-2 in a typical input (start..end); but a strange or malicious input could have hundreds/thousands of approxidates to parse.

Thus, I'm batching up all the approxidates into one rev-parse invocation (up to system argv limits right now). With the output lines split into an array, walking the output/input arrays in parallel will match them up. Hypothetically, if rev-parse were to get clever and deduplicate or reject identical inputs; then the parallel walk would be broken.

> (I have no problem in the meantime with this patch, though; any new
> method for accomplishing this would want to give other projects time to
> adapt to its use).

Yes. I think I've mentioned some years/decade ago having general functionality along the lines of "git cat-file --batch" or fast-import would be nice (even for some existing scripts and tests shipped with git). (v)fork+execve is painful even on Linux.

Previous: Jeff King
Message 3 of 3 in “t1500: ensure current --since= behavior remains”
  1. t1500: ensure current --since= behavior remainsEric Wong, Feb 10, 2021
  2. Jeff KingFeb 11, 2021
  3. Eric WongFeb 11, 2021

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.