Re: [PATCH v3 1/9] tree: do not use the_repository for tree traversal methods.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 17, 2022, 13:26 UTC
- Message-ID
- <xmqq4jw237jm.fsf@gitster.g>
- In-Reply-To
- <79959a54eb4c1a0812b1f4643530069a63e549f4.1665973401.git.gitgitgadget@gmail.com>
"Alphadelta14 via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Alphadelta14 <alpha@alphaservcomputing.solutions>
I'll fix this line to match all the other patches in the series before applying.
Show 8 quoted lines
> Expect that tree walking may switch repository contexts for cases > such as submodules. > Added compatibility macros for existing cases. > > Annotate an existing issue where repo is wrong when traversing. > > Signed-off-by: Heather Lapointe <alpha@alphaservcomputing.solutions> > ---
Show 9 quoted lines
> @@ -58,7 +58,11 @@ int read_tree_at(struct repository *r, > oid_to_hex(&entry.oid), > base->buf, entry.path); > > - if (parse_commit(commit)) > + // FIXME: This is the wrong repo instance (it refers to the superproject) > + // it will always fail as is (will fix in later patch) > + // This current codepath isn't executed by any existing callbacks > + // so it wouldn't show up as an issue at this time.
/* * We write our multi-line comments * this way. */
My suspicion is that the if/else if/ cascade for GITLINK assumes that the caller earlier did add_submodule_odb() to make sure any object it needs should be available via the_repository->objects object store. If your caller (presumably "archive that is trying to learn the --recurse-submodules option") hasn't learned to do so yet at this step, it is understandable if it fails.
> + if (repo_parse_commit(r, commit))
> die("Invalid commit %s in submodule path %s%s",
> oid_to_hex(&entry.oid),
> base->buf, entry.path);Show 5 quoted lines
> +#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS > +#define parse_tree(tree) repo_parse_tree(the_repository, tree) > +#define parse_tree_gently(tree, quiet_on_missing) repo_parse_tree_gently(the_repository, tree, quiet_on_missing) > +#define parse_tree_indirect(oid) repo_parse_tree_indirect(the_repository, oid) > +#endif
Good.