diff: migrate diff_flags.pickaxe_ignore_case to a pickaxe_opts bit

Currently flags for pickaxing are found in different places. Unify the flags into the `pickaxe_opts` field, which will contain any pickaxe related flags. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jan 4, 2018 at 14:50 UTC c1ddc4610c553b06591aac74b610b56448cbb976
3 files changed +6 -5
diff.h
+2 -1
@@ -91,7 +91,6 @@ struct diff_flags {
91 unsigned override_submodule_config:1;
92 unsigned dirstat_by_line:1;
93 unsigned funccontext:1;
94 - unsigned pickaxe_ignore_case:1;
94 unsigned default_follow_renames:1;
95 };
96
@@ -327,6 +326,8 @@ extern void diff_setup_done(struct diff_options *);
326 #define DIFF_PICKAXE_KIND_S 4 /* traditional plumbing counter */
327 #define DIFF_PICKAXE_KIND_G 8 /* grep in the patch */
328
329 +#define DIFF_PICKAXE_IGNORE_CASE 32
330 +
331 extern void diffcore_std(struct diff_options *);
332 extern void diffcore_fix_diff_index(struct diff_options *);
333
diffcore-pickaxe.c
+3 -3
@@ -222,11 +222,11 @@ void diffcore_pickaxe(struct diff_options *o)
222
223 if (opts & (DIFF_PICKAXE_REGEX | DIFF_PICKAXE_KIND_G)) {
224 int cflags = REG_EXTENDED | REG_NEWLINE;
225 - if (o->flags.pickaxe_ignore_case)
225 + if (o->pickaxe_opts & DIFF_PICKAXE_IGNORE_CASE)
226 cflags |= REG_ICASE;
227 regcomp_or_die(&regex, needle, cflags);
228 regexp = &regex;
229 - } else if (o->flags.pickaxe_ignore_case &&
229 + } else if (o->pickaxe_opts & DIFF_PICKAXE_IGNORE_CASE &&
230 has_non_ascii(needle)) {
231 struct strbuf sb = STRBUF_INIT;
232 int cflags = REG_NEWLINE | REG_ICASE;
@@ -236,7 +236,7 @@ void diffcore_pickaxe(struct diff_options *o)
236 strbuf_release(&sb);
237 regexp = &regex;
238 } else {
239 - kws = kwsalloc(o->flags.pickaxe_ignore_case
239 + kws = kwsalloc(o->pickaxe_opts & DIFF_PICKAXE_IGNORE_CASE
240 ? tolower_trans_tbl : NULL);
241 kwsincr(kws, needle, strlen(needle));
242 kwsprep(kws);
revision.c
+1 -1
@@ -2076,7 +2076,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
2076 revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_ERE;
2077 } else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
2078 revs->grep_filter.ignore_case = 1;
2079 - revs->diffopt.flags.pickaxe_ignore_case = 1;
2079 + revs->diffopt.pickaxe_opts |= DIFF_PICKAXE_IGNORE_CASE;
2080 } else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
2081 revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_FIXED;
2082 } else if (!strcmp(arg, "--perl-regexp") || !strcmp(arg, "-P")) {