Sync with maint
[gitweb.git] / builtin / grep.c
index f61a9d938b44424414812c57eecc309bd563f4b3..7e79eb1a754a5f604829e3e9e6d98d83712be9b6 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2006 Junio C Hamano
  */
 #include "cache.h"
+#include "repository.h"
 #include "config.h"
 #include "blob.h"
 #include "tree.h"
@@ -542,7 +543,7 @@ static void compile_submodule_options(const struct grep_opt *opt,
         * submodule process has its own thread pool.
         */
        argv_array_pushf(&submodule_options, "--threads=%d",
-                        (num_threads + 1) / 2);
+                        DIV_ROUND_UP(num_threads, 2));
 
        /* Add Pathspecs */
        argv_array_push(&submodule_options, "--");
@@ -643,11 +644,11 @@ static int grep_submodule_launch(struct grep_opt *opt,
 static int grep_submodule(struct grep_opt *opt, const struct object_id *oid,
                          const char *filename, const char *path)
 {
-       if (!is_submodule_initialized(path))
+       if (!is_submodule_active(the_repository, path))
                return 0;
        if (!is_submodule_populated_gently(path, NULL)) {
                /*
-                * If searching history, check for the presense of the
+                * If searching history, check for the presence of the
                 * submodule's gitdir before skipping the submodule.
                 */
                if (oid) {
@@ -1169,8 +1170,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 
        if (!opt.pattern_list)
                die(_("no pattern given."));
-       if (!opt.fixed && opt.ignore_case)
-               opt.regflags |= REG_ICASE;
 
        /*
         * We have to find "--" in a separate pass, because its presence