diff: introduce DIFF_PICKAXE_KINDS_MASK
Currently the check whether to perform pickaxing is done via checking `diffopt->pickaxe`, which contains the command line argument that we want to pickaxe for. Soon we'll introduce a new type of pickaxing, that will not store anything in the `.pickaxe` field, so let's migrate the check to be dependent on pickaxe_opts. It is not enough to just replace the check for pickaxe by pickaxe_opts, because flags might be set, but pickaxing was not requested ('-i'). To cope with that, introduce a mask to check only for the bits indicating the modes of operation. 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
cf63051adad03e827e0313a57db0a79ad39a04a0
5 files changed
+8
-6
builtin/log.c
+2
-2
@@ -180,8 +180,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
180
if (rev->show_notes)
181
init_display_notes(&rev->notes_opt);
182
183
- if (rev->diffopt.pickaxe || rev->diffopt.filter ||
184
- rev->diffopt.flags.follow_renames)
183
+ if ((rev->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
184
+ rev->diffopt.filter || rev->diffopt.flags.follow_renames)
185
rev->always_show_header = 0;
186
187
if (source)
combine-diff.c
+1
-1
@@ -1438,7 +1438,7 @@ void diff_tree_combined(const struct object_id *oid,
1438
opt->flags.follow_renames ||
1439
opt->break_opt != -1 ||
1440
opt->detect_rename ||
1441
- opt->pickaxe ||
1441
+ (opt->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
1442
opt->filter;
1443
1444
diff.c
+2
-2
@@ -4173,7 +4173,7 @@ void diff_setup_done(struct diff_options *options)
4173
/*
4174
* Also pickaxe would not work very well if you do not say recursive
4175
*/
4176
- if (options->pickaxe)
4176
+ if (options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK)
4177
options->flags.recursive = 1;
4178
/*
4179
* When patches are generated, submodules diffed against the work tree
@@ -5777,7 +5777,7 @@ void diffcore_std(struct diff_options *options)
5777
if (options->break_opt != -1)
5778
diffcore_merge_broken();
5779
}
5780
- if (options->pickaxe)
5780
+ if (options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK)
5781
diffcore_pickaxe(options);
5782
if (options->orderfile)
5783
diffcore_order(options->orderfile);
diff.h
+2
@@ -326,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_KINDS_MASK (DIFF_PICKAXE_KIND_S | DIFF_PICKAXE_KIND_G)
330
+
331
#define DIFF_PICKAXE_IGNORE_CASE 32
332
333
extern void diffcore_std(struct diff_options *);
revision.c
+1
-1
@@ -2407,7 +2407,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
2407
revs->diff = 1;
2408
2409
/* Pickaxe, diff-filter and rename following need diffs */
2410
- if (revs->diffopt.pickaxe ||
2410
+ if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
2411
revs->diffopt.filter ||
2412
revs->diffopt.flags.follow_renames)
2413
revs->diff = 1;