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

Re: [PATCH v2] odb: do not list our own refs as alternate refs in the quarantine

From
Kristofer Karlsson <krka@spotify.com>
Date
Nov 4, 2026, 10:25 UTC
Message-ID
<CAL71e4OreARF+dbCU3S8-_umrFEptPLPUiPDH3SYBx6OYjVpfg@mail.gmail.com>
In-Reply-To
<20261104024806.GA1492379@coredump.intra.peff.net>
On Wed, 4 Nov 2026 at 03:48, Jeff King <peff@peff.net> wrote:
Show 37 quoted lines
>
> I.e., I'd expect the code part of the patch to just be:
>
> diff --git a/odb.c b/odb.c
> index 2c93a9490c..f9ab5c8e7f 100644
> --- a/odb.c
> +++ b/odb.c
> @@ -183,6 +183,7 @@ static int refs_from_alternate_cb(struct odb_files_dir *alternate,
>                                   void *payload)
>  {
>         struct strbuf path = STRBUF_INIT;
> +       struct strbuf repo = STRBUF_INIT;
>         size_t base_len;
>         struct alternate_refs_data *cb = payload;
>
> @@ -198,10 +199,16 @@ static int refs_from_alternate_cb(struct odb_files_dir *alternate,
>                 goto out;
>         strbuf_setlen(&path, base_len);
>
> +       /* XXX could realpath once in caller as a mild optimization */
> +       if (strbuf_realpath(&repo, cb->repo->commondir, 0) &&
> +           !strcmp(path.buf, repo.buf))
> +               goto out;
> +
>         read_alternate_refs(cb->repo, path.buf, cb->fn, cb->payload);
>
>  out:
>         strbuf_release(&path);
> +       strbuf_release(&repo);
>         return 0;
>  }
>
>
> and keep it totally local to the path hackery in the alternate-refs
> path.
>
> Or am I missing something that requires more complication?

No, I think you are right. The quarantine parent only matters when the object directory is not under the commondir, which is rare. Your version is essentially my v1 without the "this is a hack" framing (and also cleaner).

Show 8 quoted lines
> > This is safe: alternate refs only serve as negative tips that are
> > assumed to be complete, so dropping some can only make the traversal
> > walk further, never make it accept a missing object.
>
> That's how _we_ use them in the internal callers, but it's a rev-list
> option. So we can't say how they are used elsewhere. That said, I think
> this is a totally reasonable tightening of the definition for general
> use.

Good point. I will reword that part of the commit message so that it does not rely on how the connectivity check uses them. It also seems in line with what we already do when loading alternates, where listing the object directory itself is ignored as a common mistake; inside the quarantine, that check just compares against the quarantine instead of our own object directory.

Justin suggested fixing it at the transaction layer instead, so I will wait to see where that discussion lands before sending a v3.

It looks like the remaining options are:
  1. Go with your proposed version.
  2. Do nothing until the long term fix.
  3. Just add a regression test for now.

Thanks, Kristofer

Previous: Jeff KingNext: Junio C Hamano
Message 19 of 20 in “odb: do not list our own refs as alternate refs in the quarantine”
  1. odb: do not list our own refs as alternate refs in the quarantineKristofer Karlsson via GitGitGadget, Oct 28, 2026
  2. Justin ToblerOct 29, 2026
  3. Kristofer KarlssonOct 30, 2026
  4. Junio C HamanoOct 29, 2026
  5. Kristofer KarlssonOct 30, 2026
  6. Junio C HamanoOct 30, 2026
  7. Jeff KingOct 30, 2026
  8. odb: do not list our own refs as alternate refs in the quarantineKristofer Karlsson via GitGitGadget, Nov 2, 2026
  9. Junio C HamanoNov 3, 2026
  10. Junio C HamanoNov 3, 2026
  11. Kristofer KarlssonNov 3, 2026
  12. Patrick SteinhardtNov 3, 2026
  13. Kristofer KarlssonNov 3, 2026
  14. Patrick SteinhardtNov 3, 2026
  15. Justin ToblerNov 3, 2026
  16. Kristofer KarlssonNov 4, 2026
  17. Justin ToblerNov 4, 2026
  18. Jeff KingNov 4, 2026
  19. Kristofer KarlssonNov 4, 2026
  20. Junio C HamanoNov 4, 2026

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.