Skip to content

Commit c1ddc46

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 929ed70 commit c1ddc46

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

diff.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ struct diff_flags {
9191
unsigned override_submodule_config:1;
9292
unsigned dirstat_by_line:1;
9393
unsigned funccontext:1;
94-
unsigned pickaxe_ignore_case:1;
9594
unsigned default_follow_renames:1;
9695
};
9796

@@ -327,6 +326,8 @@ extern void diff_setup_done(struct diff_options *);
327326
#define DIFF_PICKAXE_KIND_S 4 /* traditional plumbing counter */
328327
#define DIFF_PICKAXE_KIND_G 8 /* grep in the patch */
329328

329+
#define DIFF_PICKAXE_IGNORE_CASE 32
330+
330331
extern void diffcore_std(struct diff_options *);
331332
extern void diffcore_fix_diff_index(struct diff_options *);
332333

diffcore-pickaxe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ void diffcore_pickaxe(struct diff_options *o)
222222

223223
if (opts & (DIFF_PICKAXE_REGEX | DIFF_PICKAXE_KIND_G)) {
224224
int cflags = REG_EXTENDED | REG_NEWLINE;
225-
if (o->flags.pickaxe_ignore_case)
225+
if (o->pickaxe_opts & DIFF_PICKAXE_IGNORE_CASE)
226226
cflags |= REG_ICASE;
227227
regcomp_or_die(&regex, needle, cflags);
228228
regexp = &regex;
229-
} else if (o->flags.pickaxe_ignore_case &&
229+
} else if (o->pickaxe_opts & DIFF_PICKAXE_IGNORE_CASE &&
230230
has_non_ascii(needle)) {
231231
struct strbuf sb = STRBUF_INIT;
232232
int cflags = REG_NEWLINE | REG_ICASE;
@@ -236,7 +236,7 @@ void diffcore_pickaxe(struct diff_options *o)
236236
strbuf_release(&sb);
237237
regexp = &regex;
238238
} else {
239-
kws = kwsalloc(o->flags.pickaxe_ignore_case
239+
kws = kwsalloc(o->pickaxe_opts & DIFF_PICKAXE_IGNORE_CASE
240240
? tolower_trans_tbl : NULL);
241241
kwsincr(kws, needle, strlen(needle));
242242
kwsprep(kws);

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
20762076
revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_ERE;
20772077
} else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
20782078
revs->grep_filter.ignore_case = 1;
2079-
revs->diffopt.flags.pickaxe_ignore_case = 1;
2079+
revs->diffopt.pickaxe_opts |= DIFF_PICKAXE_IGNORE_CASE;
20802080
} else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
20812081
revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_FIXED;
20822082
} else if (!strcmp(arg, "--perl-regexp") || !strcmp(arg, "-P")) {

0 commit comments

Comments
 (0)