From: Junio C Hamano Date: Thu, 13 Jul 2017 23:14:54 +0000 (-0700) Subject: Merge branch 'ab/grep-lose-opt-regflags' X-Git-Tag: v2.14.0-rc0~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/eac97b438c6734304c155604f4c36ac63f29ca6f?ds=inline;hp=-c Merge branch 'ab/grep-lose-opt-regflags' Code cleanup. * ab/grep-lose-opt-regflags: grep: remove redundant REG_NEWLINE when compiling fixed regex grep: remove regflags from the public grep_opt API grep: remove redundant and verbose re-assignments to 0 grep: remove redundant "fixed" field re-assignment to 0 grep: adjust a redundant grep pattern type assignment grep: remove redundant double assignment to 0 --- eac97b438c6734304c155604f4c36ac63f29ca6f diff --combined builtin/grep.c index 0d6e669732,b682966439..7e79eb1a75 --- a/builtin/grep.c +++ b/builtin/grep.c @@@ -4,7 -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" @@@ -543,7 -542,7 +543,7 @@@ static void compile_submodule_options(c * 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, "--"); @@@ -644,11 -643,11 +644,11 @@@ static int grep_submodule_launch(struc 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) { @@@ -1170,8 -1169,6 +1170,6 @@@ int cmd_grep(int argc, const char **arg 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 diff --combined revision.c index 9ff120b305,207103d211..6603af9444 --- a/revision.c +++ b/revision.c @@@ -1142,7 -1142,7 +1142,7 @@@ int ref_excluded(struct string_list *re if (!ref_excludes) return 0; for_each_string_list_item(item, ref_excludes) { - if (!wildmatch(item->string, path, 0, NULL)) + if (!wildmatch(item->string, path, 0)) return 1; } return 0; @@@ -1362,7 -1362,6 +1362,6 @@@ void init_revisions(struct rev_info *re init_grep_defaults(); grep_init(&revs->grep_filter, prefix); revs->grep_filter.status_only = 1; - revs->grep_filter.regflags = REG_NEWLINE; diff_setup(&revs->diffopt); if (prefix && !revs->diffopt.prefix) { @@@ -2022,7 -2021,6 +2021,6 @@@ static int handle_revision_opt(struct r revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_ERE; } else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) { revs->grep_filter.ignore_case = 1; - revs->grep_filter.regflags |= REG_ICASE; DIFF_OPT_SET(&revs->diffopt, PICKAXE_IGNORE_CASE); } else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) { revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_FIXED;