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

Re: [PATCH 1/1] ls-refs.c: minimize number of refs visited

From
Jacob Vosmaer <jacob@gitlab.com>
Date
Jan 20, 2021, 10:40 UTC
Message-ID
<CADMWQoOzD0xF4PSAUo2qXp62-tTJX4DhquFZxFjfdQmy+7j+6g@mail.gmail.com>
In-Reply-To
<YAdnB3Qy46qQ2to4@coredump.intra.peff.net>
On Wed, Jan 20, 2021 at 12:11 AM Jeff King <peff@peff.net> wrote:
> It's not a _huge_ deal to me, but I think it is slightly nicer as a
> separate patch. Plus it can easily be credited to Jacob, so at least he
> gets some authorship credit out of this. :)

Thanks, I'm fine either way. Just remember that the other changes in ls-refs.c depend on that strvec_init, so if we split it out, we need to remember / maintain that (order) dependency.

> Having now looked carefully at the ls-refs code, it's a pure
> prefix-match, too. So I think we _could_ rely on for_each_fullref_in()
> returning us the correct full results, and not checking it further in
> send_ref().

I also think we could. But as I alluded to in my original commit message, I don't like how complicated that gets. I find it easier to convince myself in the current form that the longest prefix code selects _enough_ prefixes, which is a weaker property than "selects exactly the right prefixes".

Jacob
Previous: Jeff KingNext: Jacob Vosmaer
Message 7 of 8 in “ls-refs.c: minimize number of refs visited”
  1. 0/1 ls-refs.c: minimize number of refs visitedJacob Vosmaer, Jan 19, 2021
  2. 1/1 ls-refs.c: minimize number of refs visitedJacob Vosmaer, Jan 19, 2021
  3. Taylor BlauJan 19, 2021
  4. Jeff KingJan 19, 2021
  5. Taylor BlauJan 19, 2021
  6. Jeff KingJan 19, 2021
  7. Jacob VosmaerJan 20, 2021
  8. Jacob VosmaerJan 20, 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.