sha1_file: add repository argument to open_sha1_file
[gitweb.git] / builtin / grep.c
index 2d65f27d01f3da772f7bad21f101fdc0af0102ed..1e9cdbdf78ddbd803ba9fa65210fb79ff1e27583 100644 (file)
@@ -22,6 +22,7 @@
 #include "pathspec.h"
 #include "submodule.h"
 #include "submodule-config.h"
+#include "object-store.h"
 
 static char const * const grep_usage[] = {
        N_("git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]"),
@@ -431,7 +432,9 @@ static int grep_submodule(struct grep_opt *opt, struct repository *superproject,
         * store is no longer global and instead is a member of the repository
         * object.
         */
-       add_to_alternates_memory(submodule.objectdir);
+       grep_read_lock();
+       add_to_alternates_memory(submodule.objects->objectdir);
+       grep_read_unlock();
 
        if (oid) {
                struct object *object;
@@ -1013,6 +1016,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                       prefix, argv + i);
        pathspec.max_depth = opt.max_depth;
        pathspec.recursive = 1;
+       pathspec.recurse_submodules = !!recurse_submodules;
 
 #ifndef NO_PTHREADS
        if (list.nr || cached || show_in_pager)