Skip to content

Commit cf63051

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

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

builtin/log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
180180
if (rev->show_notes)
181181
init_display_notes(&rev->notes_opt);
182182

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)
185185
rev->always_show_header = 0;
186186

187187
if (source)

combine-diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ void diff_tree_combined(const struct object_id *oid,
14381438
opt->flags.follow_renames ||
14391439
opt->break_opt != -1 ||
14401440
opt->detect_rename ||
1441-
opt->pickaxe ||
1441+
(opt->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
14421442
opt->filter;
14431443

14441444

diff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4173,7 +4173,7 @@ void diff_setup_done(struct diff_options *options)
41734173
/*
41744174
* Also pickaxe would not work very well if you do not say recursive
41754175
*/
4176-
if (options->pickaxe)
4176+
if (options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK)
41774177
options->flags.recursive = 1;
41784178
/*
41794179
* When patches are generated, submodules diffed against the work tree
@@ -5777,7 +5777,7 @@ void diffcore_std(struct diff_options *options)
57775777
if (options->break_opt != -1)
57785778
diffcore_merge_broken();
57795779
}
5780-
if (options->pickaxe)
5780+
if (options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK)
57815781
diffcore_pickaxe(options);
57825782
if (options->orderfile)
57835783
diffcore_order(options->orderfile);

diff.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ extern void diff_setup_done(struct diff_options *);
326326
#define DIFF_PICKAXE_KIND_S 4 /* traditional plumbing counter */
327327
#define DIFF_PICKAXE_KIND_G 8 /* grep in the patch */
328328

329+
#define DIFF_PICKAXE_KINDS_MASK (DIFF_PICKAXE_KIND_S | DIFF_PICKAXE_KIND_G)
330+
329331
#define DIFF_PICKAXE_IGNORE_CASE 32
330332

331333
extern void diffcore_std(struct diff_options *);

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
24072407
revs->diff = 1;
24082408

24092409
/* Pickaxe, diff-filter and rename following need diffs */
2410-
if (revs->diffopt.pickaxe ||
2410+
if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
24112411
revs->diffopt.filter ||
24122412
revs->diffopt.flags.follow_renames)
24132413
revs->diff = 1;

0 commit comments

Comments
 (0)