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>maint
parent
c1ddc4610c
commit
cf63051ada
|
@ -180,8 +180,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
|
||||||
if (rev->show_notes)
|
if (rev->show_notes)
|
||||||
init_display_notes(&rev->notes_opt);
|
init_display_notes(&rev->notes_opt);
|
||||||
|
|
||||||
if (rev->diffopt.pickaxe || rev->diffopt.filter ||
|
if ((rev->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
|
||||||
rev->diffopt.flags.follow_renames)
|
rev->diffopt.filter || rev->diffopt.flags.follow_renames)
|
||||||
rev->always_show_header = 0;
|
rev->always_show_header = 0;
|
||||||
|
|
||||||
if (source)
|
if (source)
|
||||||
|
|
|
@ -1438,7 +1438,7 @@ void diff_tree_combined(const struct object_id *oid,
|
||||||
opt->flags.follow_renames ||
|
opt->flags.follow_renames ||
|
||||||
opt->break_opt != -1 ||
|
opt->break_opt != -1 ||
|
||||||
opt->detect_rename ||
|
opt->detect_rename ||
|
||||||
opt->pickaxe ||
|
(opt->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
|
||||||
opt->filter;
|
opt->filter;
|
||||||
|
|
||||||
|
|
||||||
|
|
4
diff.c
4
diff.c
|
@ -4173,7 +4173,7 @@ void diff_setup_done(struct diff_options *options)
|
||||||
/*
|
/*
|
||||||
* Also pickaxe would not work very well if you do not say recursive
|
* Also pickaxe would not work very well if you do not say recursive
|
||||||
*/
|
*/
|
||||||
if (options->pickaxe)
|
if (options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK)
|
||||||
options->flags.recursive = 1;
|
options->flags.recursive = 1;
|
||||||
/*
|
/*
|
||||||
* When patches are generated, submodules diffed against the work tree
|
* When patches are generated, submodules diffed against the work tree
|
||||||
|
@ -5777,7 +5777,7 @@ void diffcore_std(struct diff_options *options)
|
||||||
if (options->break_opt != -1)
|
if (options->break_opt != -1)
|
||||||
diffcore_merge_broken();
|
diffcore_merge_broken();
|
||||||
}
|
}
|
||||||
if (options->pickaxe)
|
if (options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK)
|
||||||
diffcore_pickaxe(options);
|
diffcore_pickaxe(options);
|
||||||
if (options->orderfile)
|
if (options->orderfile)
|
||||||
diffcore_order(options->orderfile);
|
diffcore_order(options->orderfile);
|
||||||
|
|
2
diff.h
2
diff.h
|
@ -326,6 +326,8 @@ extern void diff_setup_done(struct diff_options *);
|
||||||
#define DIFF_PICKAXE_KIND_S 4 /* traditional plumbing counter */
|
#define DIFF_PICKAXE_KIND_S 4 /* traditional plumbing counter */
|
||||||
#define DIFF_PICKAXE_KIND_G 8 /* grep in the patch */
|
#define DIFF_PICKAXE_KIND_G 8 /* grep in the patch */
|
||||||
|
|
||||||
|
#define DIFF_PICKAXE_KINDS_MASK (DIFF_PICKAXE_KIND_S | DIFF_PICKAXE_KIND_G)
|
||||||
|
|
||||||
#define DIFF_PICKAXE_IGNORE_CASE 32
|
#define DIFF_PICKAXE_IGNORE_CASE 32
|
||||||
|
|
||||||
extern void diffcore_std(struct diff_options *);
|
extern void diffcore_std(struct diff_options *);
|
||||||
|
|
|
@ -2407,7 +2407,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
|
||||||
revs->diff = 1;
|
revs->diff = 1;
|
||||||
|
|
||||||
/* Pickaxe, diff-filter and rename following need diffs */
|
/* Pickaxe, diff-filter and rename following need diffs */
|
||||||
if (revs->diffopt.pickaxe ||
|
if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
|
||||||
revs->diffopt.filter ||
|
revs->diffopt.filter ||
|
||||||
revs->diffopt.flags.follow_renames)
|
revs->diffopt.flags.follow_renames)
|
||||||
revs->diff = 1;
|
revs->diff = 1;
|
||||||
|
|
Loading…
Reference in New Issue