git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: git@vger.kernel.org, Justin Tobler <jltobler@gmail.com>
Subject: Re: [PATCH v2 4/8] odb: adapt `odb_add_to_alternates_file()` to call `odb_add_source()`
Date: Thu, 11 Dec 2025 10:29:43 +0100	[thread overview]
Message-ID: <aTqPBygCfm1hWtL-@pks.im> (raw)
In-Reply-To: <aTpxB8gS7wG7rRJQ@szeder.dev>

On Thu, Dec 11, 2025 at 08:21:43AM +0100, SZEDER Gábor wrote:
> On Wed, Dec 10, 2025 at 04:32:37PM +0100, Patrick Steinhardt wrote:
> > When calling `odb_add_to_alternates_file()` we know to add the newly
> > added source to the object database in case we have already loaded
> > alternates. This is done so that we can make its objects accessible
> > immediately without having to fully reload all alternates.
> > 
> > The way we do this though is to call `link_alt_odb_entries()`, which
> > adds _multiple_ sources to the object database source in case we have
> > newline-separated entries. This behaviour is not documented in the
> > function documentation of `odb_add_to_alternates_file()`, and all
> > callers only ever pass a single directory to it. It's thus entirely
> > surprising and a conceptual mismatch.
> > 
> > Fix this issue by directly calling `odb_add_source()` instead.
> 
> OK, but:
> 
> > diff --git a/odb.c b/odb.c
> > index e314f86c3b..d97e50fb61 100644
> > --- a/odb.c
> > +++ b/odb.c
> > @@ -338,7 +338,7 @@ void odb_add_to_alternates_file(struct object_database *odb,
> >  		if (commit_lock_file(&lock))
> >  			die_errno(_("unable to move new alternates file into place"));
> >  		if (odb->loaded_alternates)
> > -			link_alt_odb_entries(odb, dir, '\n', NULL, 0);
> > +			odb_add_source(odb, dir, 0);
> 
>       CC odb.o
>   odb.c: In function ‘odb_add_to_alternates_file’:
>   odb.c:341:25: error: implicit declaration of function ‘odb_add_source’; did you mean ‘odb_find_source’? [-Werror=implicit-function-declaration]
>     341 |                         odb_add_source(odb, dir, 0);
>         |                         ^~~~~~~~~~~~~~
>         |                         odb_find_source
>   cc1: all warnings being treated as errors
>   make: *** [Makefile:2864: odb.o] Error 1

Hrmpf, I only fixed this callsite in a later commit indeed.

> Note, that several commit messages also refer to this non-existing
> function from the previous round.

True. Will fix both of these issues, thanks!

Patrick

  reply	other threads:[~2025-12-11  9:29 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-08  8:04 [PATCH 0/8] Refactor handling of alternates to work via sources Patrick Steinhardt
2025-12-08  8:04 ` [PATCH 1/8] odb: refactor parsing of alternates to be self-contained Patrick Steinhardt
2025-12-08 22:37   ` Justin Tobler
2025-12-08  8:04 ` [PATCH 2/8] odb: resolve relative alternative paths when parsing Patrick Steinhardt
2025-12-09  2:09   ` Justin Tobler
2025-12-09  8:04     ` Patrick Steinhardt
2025-12-09 18:06       ` Justin Tobler
2025-12-10  5:53         ` Patrick Steinhardt
2025-12-08  8:04 ` [PATCH 3/8] odb: move computation of normalized objdir into `alt_odb_usable()` Patrick Steinhardt
2025-12-09  2:34   ` Justin Tobler
2025-12-09  8:04     ` Patrick Steinhardt
2025-12-08  8:04 ` [PATCH 4/8] odb: adapt `odb_add_to_alternates_file()` to call `odb_add_source()` Patrick Steinhardt
2025-12-08  8:04 ` [PATCH 5/8] odb: remove mutual recursion when parsing alternates Patrick Steinhardt
2025-12-09 17:31   ` Justin Tobler
2025-12-08  8:04 ` [PATCH 6/8] odb: drop forward declaration of `read_info_alternates()` Patrick Steinhardt
2025-12-08  8:04 ` [PATCH 7/8] odb: read alternates via sources Patrick Steinhardt
2025-12-09 17:49   ` Justin Tobler
2025-12-10  5:54     ` Patrick Steinhardt
2025-12-08  8:04 ` [PATCH 8/8] odb: write " Patrick Steinhardt
2025-12-10 15:32 ` [PATCH v2 0/8] Refactor handling of alternates to work " Patrick Steinhardt
2025-12-10 15:32   ` [PATCH v2 1/8] odb: refactor parsing of alternates to be self-contained Patrick Steinhardt
2025-12-10 15:32   ` [PATCH v2 2/8] odb: resolve relative alternative paths when parsing Patrick Steinhardt
2025-12-10 15:32   ` [PATCH v2 3/8] odb: move computation of normalized objdir into `alt_odb_usable()` Patrick Steinhardt
2025-12-10 15:32   ` [PATCH v2 4/8] odb: adapt `odb_add_to_alternates_file()` to call `odb_add_source()` Patrick Steinhardt
2025-12-11  7:21     ` SZEDER Gábor
2025-12-11  9:29       ` Patrick Steinhardt [this message]
2025-12-10 15:32   ` [PATCH v2 5/8] odb: remove mutual recursion when parsing alternates Patrick Steinhardt
2025-12-10 15:32   ` [PATCH v2 6/8] odb: drop forward declaration of `read_info_alternates()` Patrick Steinhardt
2025-12-10 15:32   ` [PATCH v2 7/8] odb: read alternates via sources Patrick Steinhardt
2025-12-10 15:32   ` [PATCH v2 8/8] odb: write " Patrick Steinhardt
2025-12-10 20:00   ` [PATCH v2 0/8] Refactor handling of alternates to work " Justin Tobler
2025-12-11  5:01     ` Patrick Steinhardt
2025-12-11  9:30 ` [PATCH v3 " Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 1/8] odb: refactor parsing of alternates to be self-contained Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 2/8] odb: resolve relative alternative paths when parsing Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 3/8] odb: move computation of normalized objdir into `alt_odb_usable()` Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 4/8] odb: stop splitting alternate in `odb_add_to_alternates_file()` Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 5/8] odb: remove mutual recursion when parsing alternates Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 6/8] odb: drop forward declaration of `read_info_alternates()` Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 7/8] odb: read alternates via sources Patrick Steinhardt
2025-12-11  9:30   ` [PATCH v3 8/8] odb: write " Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTqPBygCfm1hWtL-@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).