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

Re: [PATCH 05/16] refs: pass repo when retrieving submodule ref store

From
Junio C Hamano <gitster@pobox.com>
Date
May 16, 2024, 18:44 UTC
Message-ID
<xmqqy189ppfi.fsf@gitster.g>
In-Reply-To
<1d48289809d5bff3d168b42b2b7f150e3ee953e2.1715836916.git.ps@pks.im>
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.
Show 13 quoted lines
> 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?

Show 24 quoted lines
> @@ -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.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 16 of 33 in “refs: drop all references to `the_repository`”
  1. 00/16 refs: drop all references to `the_repository`Patrick Steinhardt, May 16, 2024
  2. 01/16 refs: adjust names for `init` and `init_db` callbacksPatrick Steinhardt, May 16, 2024
  3. Karthik NayakMay 16, 2024
  4. 02/16 refs: rename `init_db` callback to avoid confusionPatrick Steinhardt, May 16, 2024
  5. Karthik NayakMay 16, 2024
  6. Junio C HamanoMay 16, 2024
  7. Patrick SteinhardtMay 17, 2024
  8. 03/16 refs: implement releasing ref storagesPatrick Steinhardt, May 16, 2024
  9. Karthik NayakMay 16, 2024
  10. Junio C HamanoMay 16, 2024
  11. Patrick SteinhardtMay 17, 2024
  12. Patrick SteinhardtMay 17, 2024
  13. 04/16 refs: track ref stores via strmapPatrick Steinhardt, May 16, 2024
  14. Junio C HamanoMay 16, 2024
  15. 05/16 refs: pass repo when retrieving submodule ref storePatrick Steinhardt, May 16, 2024
  16. Junio C HamanoMay 16, 2024
  17. Patrick SteinhardtMay 17, 2024
  18. 06/16 refs: refactor `resolve_gitlink_ref()` to accept a repositoryPatrick Steinhardt, May 16, 2024
  19. Junio C HamanoMay 16, 2024
  20. 07/16 refs: retrieve worktree ref stores via associated repositoryPatrick Steinhardt, May 16, 2024
  21. 08/16 refs: convert iteration over replace refs to accept ref storePatrick Steinhardt, May 16, 2024
  22. 09/16 refs: pass ref store when detecting dangling symrefsPatrick Steinhardt, May 16, 2024
  23. 10/16 refs: move object peeling into "object.c"Patrick Steinhardt, May 16, 2024
  24. Junio C HamanoMay 16, 2024
  25. 11/16 refs: pass repo when peeling objectsPatrick Steinhardt, May 16, 2024
  26. 12/16 refs: drop `git_default_branch_name()`Patrick Steinhardt, May 16, 2024
  27. Karthik NayakMay 16, 2024
  28. 13/16 refs: remove `dwim_log()`Patrick Steinhardt, May 16, 2024
  29. 14/16 refs/files: use correct repositoryPatrick Steinhardt, May 16, 2024
  30. 15/16 refs/files: remove references to `the_hash_algo`Patrick Steinhardt, May 16, 2024
  31. 16/16 refs/packed: remove references to `the_hash_algo`Patrick Steinhardt, May 16, 2024
  32. Karthik NayakMay 16, 2024
  33. Patrick SteinhardtMay 17, 2024

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.