git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 05/16] refs: pass repo when retrieving submodule ref store
Date: Thu, 16 May 2024 11:44:17 -0700	[thread overview]
Message-ID: <xmqqy189ppfi.fsf@gitster.g> (raw)
In-Reply-To: <1d48289809d5bff3d168b42b2b7f150e3ee953e2.1715836916.git.ps@pks.im> (Patrick Steinhardt's message of "Thu, 16 May 2024 10:04:33 +0200")

Patrick Steinhardt <ps@pks.im> writes:

> Modify the function to accept the parent repository as parameter and
> move the global map into `struct repository`. Like this it becomes
> possible to look up submodule ref stores for arbitrary repositories.

Hmph.

> diff --git a/refs.c b/refs.c
> index 542acb25ff..86008ce7b4 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1949,8 +1949,7 @@ int resolve_gitlink_ref(const char *submodule, const char *refname,
>  	struct ref_store *refs;
>  	int flags;
>  
> -	refs = get_submodule_ref_store(submodule);
> -
> +	refs = repo_get_submodule_ref_store(the_repository, submodule);
>  	if (!refs)
>  		return -1;

This still wants to work on the_repository, which means at this 5th
step of 16-patch series, we cannot do a submodule of a submodule
that hangs below the top-level superproject yet?

> @@ -2069,20 +2066,15 @@ struct ref_store *get_submodule_ref_store(const char *submodule)
>  		goto done;
>  
>  	subrepo = xmalloc(sizeof(*subrepo));
> -	/*
> -	 * NEEDSWORK: Make get_submodule_ref_store() work with arbitrary
> -	 * superprojects other than the_repository. This probably should be
> -	 * done by making it take a struct repository * parameter instead of a
> -	 * submodule path.
> -	 */
> -	if (repo_submodule_init(subrepo, the_repository, submodule,
> +
> +	if (repo_submodule_init(subrepo, repo, submodule,
>  				null_oid())) {
>  		free(subrepo);
>  		goto done;
>  	}
>  	refs = ref_store_init(subrepo, submodule_sb.buf,
>  			      REF_STORE_READ | REF_STORE_ODB);
> -	register_ref_store_map(&submodule_ref_stores, "submodule",
> +	register_ref_store_map(&repo->submodule_ref_stores, "submodule",
>  			       refs, submodule);
>  
>  done:

Nice.

  reply	other threads:[~2024-05-16 18:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16  8:04 [PATCH 00/16] refs: drop all references to `the_repository` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 01/16] refs: adjust names for `init` and `init_db` callbacks Patrick Steinhardt
2024-05-16 14:50   ` Karthik Nayak
2024-05-16  8:04 ` [PATCH 02/16] refs: rename `init_db` callback to avoid confusion Patrick Steinhardt
2024-05-16 15:00   ` Karthik Nayak
2024-05-16 18:24   ` Junio C Hamano
2024-05-17  7:08     ` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 03/16] refs: implement releasing ref storages Patrick Steinhardt
2024-05-16 16:39   ` Karthik Nayak
2024-05-16 18:01     ` Junio C Hamano
2024-05-17  7:09       ` Patrick Steinhardt
2024-05-17  7:08     ` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 04/16] refs: track ref stores via strmap Patrick Steinhardt
2024-05-16 18:34   ` Junio C Hamano
2024-05-16  8:04 ` [PATCH 05/16] refs: pass repo when retrieving submodule ref store Patrick Steinhardt
2024-05-16 18:44   ` Junio C Hamano [this message]
2024-05-17  7:09     ` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 06/16] refs: refactor `resolve_gitlink_ref()` to accept a repository Patrick Steinhardt
2024-05-16 18:45   ` Junio C Hamano
2024-05-16  8:04 ` [PATCH 07/16] refs: retrieve worktree ref stores via associated repository Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 08/16] refs: convert iteration over replace refs to accept ref store Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 09/16] refs: pass ref store when detecting dangling symrefs Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 10/16] refs: move object peeling into "object.c" Patrick Steinhardt
2024-05-16 20:55   ` Junio C Hamano
2024-05-16  8:05 ` [PATCH 11/16] refs: pass repo when peeling objects Patrick Steinhardt
2024-05-16  8:05 ` [PATCH 12/16] refs: drop `git_default_branch_name()` Patrick Steinhardt
2024-05-16 18:44   ` Karthik Nayak
2024-05-16  8:05 ` [PATCH 13/16] refs: remove `dwim_log()` Patrick Steinhardt
2024-05-16  8:05 ` [PATCH 14/16] refs/files: use correct repository Patrick Steinhardt
2024-05-16  8:05 ` [PATCH 15/16] refs/files: remove references to `the_hash_algo` Patrick Steinhardt
2024-05-16  8:05 ` [PATCH 16/16] refs/packed: " Patrick Steinhardt
2024-05-16 18:57 ` [PATCH 00/16] refs: drop all references to `the_repository` Karthik Nayak
2024-05-17  7:08   ` 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=xmqqy189ppfi.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).