summaryrefslogtreecommitdiffstats
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-09-09 20:47:28 +0200
committerJunio C Hamano <gitster@pobox.com>2021-09-09 23:09:30 +0200
commit8eb8dcf94643ca6e7c3f040f3e0bf96e11c7ae47 (patch)
treef7e2ee9926bed0f5382f492687ca830a599c993c /builtin/grep.c
parentsubmodule: remove unnecessary unabsorbed fallback (diff)
downloadgit-8eb8dcf94643ca6e7c3f040f3e0bf96e11c7ae47.tar.xz
git-8eb8dcf94643ca6e7c3f040f3e0bf96e11c7ae47.zip
repository: support unabsorbed in repo_submodule_init
In preparation for a subsequent commit that migrates code using add_submodule_odb() to repo_submodule_init(), teach repo_submodule_init() to support submodules with unabsorbed gitdirs. (See the documentation for "git submodule absorbgitdirs" for more information about absorbed and unabsorbed gitdirs.) Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 51278b01fa..8af5249a7b 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -433,17 +433,14 @@ static int grep_submodule(struct grep_opt *opt,
{
struct repository *subrepo;
struct repository *superproject = opt->repo;
- const struct submodule *sub;
struct grep_opt subopt;
int hit = 0;
- sub = submodule_from_path(superproject, null_oid(), path);
-
if (!is_submodule_active(superproject, path))
return 0;
subrepo = xmalloc(sizeof(*subrepo));
- if (repo_submodule_init(subrepo, superproject, sub)) {
+ if (repo_submodule_init(subrepo, superproject, path, null_oid())) {
free(subrepo);
return 0;
}