]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/grep.c
Sync with 2.31.5
[thirdparty/git.git] / builtin / grep.c
index ccd8d08f3dd4992dff5c837b064a63c1f5d94a8c..ab8822e68f42dab702d096f28b88c492e6a3f4ef 100644 (file)
@@ -421,7 +421,7 @@ static int grep_submodule(struct grep_opt *opt,
        struct grep_opt subopt;
        int hit;
 
-       sub = submodule_from_path(superproject, &null_oid, path);
+       sub = submodule_from_path(superproject, null_oid(), path);
 
        if (!is_submodule_active(superproject, path))
                return 0;
@@ -504,6 +504,8 @@ static int grep_cache(struct grep_opt *opt,
        if (repo_read_index(repo) < 0)
                die(_("index file corrupt"));
 
+       /* TODO: audit for interaction with sparse-index. */
+       ensure_full_index(repo->index);
        for (nr = 0; nr < repo->index->cache_nr; nr++) {
                const struct cache_entry *ce = repo->index->cache[nr];
 
@@ -1181,6 +1183,5 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                run_pager(&opt, prefix);
        clear_pathspec(&pathspec);
        free_grep_patterns(&opt);
-       grep_destroy();
        return !hit;
 }