All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Jayesh Daga via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,  Justin Tobler <jltobler@gmail.com>,
	 Ayush Chandekar <ayu.chandekar@gmail.com>,
	 Siddharth Asthana <siddharthasthana31@gmail.com>,
	 Jayesh Daga <jayeshdaga99@gmail.com>
Subject: Re: [PATCH] unpack-trees: use explicit repository in trace2 calls
Date: Tue, 31 Mar 2026 13:27:57 -0700	[thread overview]
Message-ID: <xmqqjyurzquq.fsf@gitster.g> (raw)
In-Reply-To: <xmqqy0j82ex8.fsf@gitster.g> (Junio C. Hamano's message of "Tue, 31 Mar 2026 08:32:03 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Patrick Steinhardt <ps@pks.im> writes:
>
>> The changes in `unpack_trees()` are a bit misleading -- while it reads
>> as if we don't use `the_repository` anymore, we still do because the
>> function starts with:
>>
>>   int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options *o)
>>   {
>>   	struct repository *repo = the_repository;
>>
>> So would it make sense to maybe have a separate patch where we inject a
>> repository as a parameter to `unpack_trees()`?
>
> We can see that "struct unpack_trees_options" is rich enough in the
> merge context that it would be a natural place to have it unless it
> is already tehre.
>
> In fact, o->dst_index->repo should probably be what you want, and
> because it would be insane to start from an index in a repo and
> store the resulting updated index in another repo, there probably
> needs an assert(o->dst_index->repo == o->src_index->repo) somewhere.

Actually, assert(dst_index->repo == src_index->repo) is probably not
what we want, as dst_index can legitimately be NULL, even since
34110cd4 (Make 'unpack_trees()' have a separate source and
destination index, 2008-03-06) introduced srparete src/dst indices
to unpack_trees() API.

    We will always unpack into our own internal index, but we will take the
    source from wherever specified, and we will optionally write the result
    to a specified index (optionally, because not everybody even _wants_ any
    result: the index diffing really wants to just walk the tree and index
    in parallel).

So o->src_index->repo is what we want in this case, I think.

  reply	other threads:[~2026-03-31 20:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 20:13 [PATCH] unpack-trees: use explicit repository in trace2 calls Jayesh Daga via GitGitGadget
2026-03-31  5:31 ` Patrick Steinhardt
2026-03-31 15:32   ` Junio C Hamano
2026-03-31 20:27     ` Junio C Hamano [this message]
2026-03-31 15:34 ` [PATCH v2 0/2] " Jayesh Daga via GitGitGadget
2026-03-31 15:34   ` [PATCH v2 1/2] unpack-trees: use repository from index instead of global Jayesh Daga via GitGitGadget
2026-03-31 15:34   ` [PATCH v2 2/2] " Jayesh Daga via GitGitGadget
2026-03-31 21:35   ` [PATCH v2 0/2] unpack-trees: use explicit repository in trace2 calls 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=xmqqjyurzquq.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ayu.chandekar@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=jayeshdaga99@gmail.com \
    --cc=jltobler@gmail.com \
    --cc=ps@pks.im \
    --cc=siddharthasthana31@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.