Re: [PATCH] builtin/grep.c: remote superflous submodule code
- Date: Wed, 10 Oct 2018 15:49:13 -0700
- From: Stefan Beller <sbeller@xxxxxxxxxx>
- Subject: Re: [PATCH] builtin/grep.c: remote superflous submodule code
On Tue, Oct 9, 2018 at 5:10 PM Jonathan Tan <jonathantanmy@xxxxxxxxxx> wrote:
> > It claimed that grep would still need some explicit handling, but that is
> > not the call to repo_read_gitmodules (applying this patch on top of
> > ff6f1f564c4 still keep the test suite happy, specifically
> > t7814-grep-recurse-submodules, which contains a test
> > "grep history with moved submoules")
> Firstly, spelling of "remove" and "superfluous" in the commit title.
> I don't think the "grep history with moved submodules" test exercises
> much. That test only tests the superproject > submodule case, but we
> need a superproject > submodule > sub-submodule case, because what is
> being removed is a call to repo_read_gitmodules() on a repository
> ("struct repository submodule") that has a superproject ("struct
> repository *superproject"). In other words, we need a submodule that has
> its own gitmodules.
Right; we do have a test 'grep and nested submodules', which still passes.
I added another test, that would grep through nested submodules in
the history (not checked out), but that would not work on nested submodules
with or without this patch applied. (As the nested submodule is not checked
out, is_submodule_active(repo, path) would return false and we'd not dive
into the nested submodule.
I looked into ao/submodule-wo-gitmodules-checked-out, as that touches
this area of code as well and promises to allow working with submodules
when .gitmodules is not checked out, it doesn't help this use case, either.
That is (as Antonio diagnosed), due to get_oid not working with a repository
> > The special handling is the call to gitmodules_config_oid which was added
> > already in 74ed43711f (grep: enable recurse-submodules to work on
> > <tree> objects, 2016-12-16), but then was still named
> > gitmodules_config_sha1.
> If you're stating that gitmodules_config_oid() is where the .gitmodules
> file is lazily loaded, it doesn't seem to be that way, because that
> function works only on the_repository (at least on 'master' and 'next').
yes, that is why nested submodules do not work currently when they
are not in the working tree.
> > This is a resend of origin/sb/grep-submodule-cleanup,
> > and I think picking ff6f1f564c4 as the base for the series would
> > also be appropriate.
> Any particular reason why you suggest that commit (which is more than a
> year old)? It seems that basing this on 'master' is fine.
After more analysis, I think we'd want to wait for Antonios series to land
and then build on top of that, while also getting get_oid converted.
Regarding this patch, let's retract it for now and revisit it once we have
more submodule infrastructure working.