This patch series removes the need to add submodule ODBs as alternates in all codepaths covered by t7814. I believe that that is also all the codepaths covered by "git grep", but if it isn't, the uncovered codepaths will still work - they will just not benefit from the performance improvements. In doing this work of migrating away from adding submodule ODBs as alternates, I'm mainly motivated by the possibility of adding partial clone submodule support, but this has benefits even for those who do not use partial clones, as described in the documentation in patch 1. To reviewers: you can cherry-pick the last patch onto one of the earlier ones to observe what happens when the code still accesses a submodule object as if it were in the_repository. Jonathan Tan (7): submodule: lazily add submodule ODBs as alternates grep: use submodule-ODB-as-alternate lazy-addition grep: typesafe versions of grep_source_init grep: read submodule entry with explicit repo grep: allocate subrepos on heap grep: add repository to OID grep sources t7814: show lack of alternate ODB-adding builtin/grep.c | 49 +++++++++++++++++++++--------- grep.c | 48 ++++++++++++++++++----------- grep.h | 10 ++++-- object-file.c | 5 +++ submodule.c | 25 ++++++++++++++- submodule.h | 8 +++++ t/README | 10 ++++++ t/t7814-grep-recurse-submodules.sh | 3 ++ 8 files changed, 122 insertions(+), 36 deletions(-) -- 2.33.0.rc1.237.g0d66db33f3-goog