Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Justin Tobler <jltobler@gmail.com>
Cc: Patrick Steinhardt <ps@pks.im>,  git@vger.kernel.org
Subject: Re: [PATCH 3/6] odb: add `source` field to struct object_info_source
Date: Mon, 29 Jun 2026 13:47:41 -0700	[thread overview]
Message-ID: <xmqqmrwdul8y.fsf@gitster.g> (raw)
In-Reply-To: <akKtc4ybxFRVJmNv@denethor> (Justin Tobler's message of "Mon, 29 Jun 2026 12:49:08 -0500")

Justin Tobler <jltobler@gmail.com> writes:

>> @@ -1424,6 +1424,10 @@ int packed_object_info_with_index_pos(struct odb_source_packed *source UNUSED,
>>  	oi->whence = OI_PACKED;
>>  
>>  	if (oi->sourcep) {
>> +		if (!source)
>> +			BUG("cannot request source without an owning source");
>> +		oi->sourcep->source = &source->base;
>
> And here it is set for the packed backend. Looks good.
>
> Naive question: I understand that some `packed_info_object()` callers
> may not have the `struct odb_source` on hand, but when the `struct
> packed_git` is intially setup, is it not always known the ODB source it
> comes from? It makes me wonder if the ODB source should also be recorded
> when `struct packed_git` is initialized.

As with your reaction to [PATCH 1/6], I do share this puzzlement: if
the source can almost always be NULL, what is it good for and isn't
it something that can be computed from the available information?

Perhaps it is the naming?

I am confused what the above quoted code actually is doing ("if you
have a source, then grab its base and set it to .source member of
the struct the out parameter points at", makes it sound like the out
parameter sourcep should be pointing at a structure with .base
member, not .source member, or perhaps the caller should be passing
&oi->sourcep->source as *base to be assigned to, or something).

  reply	other threads:[~2026-06-29 20:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 12:19 [PATCH 0/6] odb: refactor source-specific information in object info Patrick Steinhardt
2026-06-24 12:19 ` [PATCH 1/6] packfile: thread odb_source_packed through packed_object_info() Patrick Steinhardt
2026-06-29 17:01   ` Justin Tobler
2026-06-24 12:19 ` [PATCH 2/6] odb: make backend-specific fields optional Patrick Steinhardt
2026-06-29 17:25   ` Justin Tobler
2026-06-24 12:19 ` [PATCH 3/6] odb: add `source` field to struct object_info_source Patrick Steinhardt
2026-06-29 17:49   ` Justin Tobler
2026-06-29 20:47     ` Junio C Hamano [this message]
2026-06-24 12:19 ` [PATCH 4/6] treewide: convert users of `whence` to the new source field Patrick Steinhardt
2026-06-29 17:55   ` Justin Tobler
2026-06-24 12:19 ` [PATCH 5/6] odb: drop `whence` field from object info Patrick Steinhardt
2026-06-29 17:57   ` Justin Tobler
2026-06-24 12:19 ` [PATCH 6/6] odb: document object info fields Patrick Steinhardt
2026-06-24 17:13 ` [PATCH 0/6] odb: refactor source-specific information in object info Junio C Hamano

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=xmqqmrwdul8y.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    --cc=ps@pks.im \
    /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