diff: remove DIFF_OPT_SET macro

Remove the `DIFF_OPT_SET` macro and instead set the flags directly. This conversion is done using the following semantic patch: @@ expression E; identifier fld; @@ - DIFF_OPT_SET(&E, fld) + E.flags.fld = 1 @@ type T; T *ptr; identifier fld; @@ - DIFF_OPT_SET(ptr, fld) + ptr->flags.fld = 1 Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Oct 31, 2017 at 11:19 UTC 23dcf77f48feb49c54bad09210f093a799816334
20 files changed +90 -91
blame.c
+4 -4
@@ -541,7 +541,7 @@ static struct blame_origin *find_origin(struct commit *parent,
541 * same and diff-tree is fairly efficient about this.
542 */
543 diff_setup(&diff_opts);
544 - DIFF_OPT_SET(&diff_opts, RECURSIVE);
544 + diff_opts.flags.RECURSIVE = 1;
545 diff_opts.detect_rename = 0;
546 diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
547 paths[0] = origin->path;
@@ -615,7 +615,7 @@ static struct blame_origin *find_rename(struct commit *parent,
615 int i;
616
617 diff_setup(&diff_opts);
618 - DIFF_OPT_SET(&diff_opts, RECURSIVE);
618 + diff_opts.flags.RECURSIVE = 1;
619 diff_opts.detect_rename = DIFF_DETECT_RENAME;
620 diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
621 diff_opts.single_follow = origin->path;
@@ -1238,7 +1238,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
1238 return; /* nothing remains for this target */
1239
1240 diff_setup(&diff_opts);
1241 - DIFF_OPT_SET(&diff_opts, RECURSIVE);
1241 + diff_opts.flags.RECURSIVE = 1;
1242 diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
1243
1244 diff_setup_done(&diff_opts);
@@ -1253,7 +1253,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
1253 if ((opt & PICKAXE_BLAME_COPY_HARDEST)
1254 || ((opt & PICKAXE_BLAME_COPY_HARDER)
1255 && (!porigin || strcmp(target->path, porigin->path))))
1256 - DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
1256 + diff_opts.flags.FIND_COPIES_HARDER = 1;
1257
1258 if (is_null_oid(&target->commit->object.oid))
1259 do_diff_cache(&parent->tree->object.oid, &diff_opts);
builtin/add.c
+2 -2
@@ -116,7 +116,7 @@ int add_files_to_cache(const char *prefix,
116 rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
117 rev.diffopt.format_callback = update_callback;
118 rev.diffopt.format_callback_data = &data;
119 - DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
119 + rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
120 rev.max_count = 0; /* do not compare unmerged paths with stage #2 */
121 run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
122 clear_pathspec(&rev.prune_data);
@@ -218,7 +218,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
218 argc = setup_revisions(argc, argv, &rev, NULL);
219 rev.diffopt.output_format = DIFF_FORMAT_PATCH;
220 rev.diffopt.use_color = 0;
221 - DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
221 + rev.diffopt.flags.IGNORE_DIRTY_SUBMODULES = 1;
222 out = open(file, O_CREAT | O_WRONLY, 0666);
223 if (out < 0)
224 die(_("Could not open '%s' for writing."), file);
builtin/am.c
+4 -4
@@ -1157,9 +1157,9 @@ static int index_has_changes(struct strbuf *sb)
1157 struct diff_options opt;
1158
1159 diff_setup(&opt);
1160 - DIFF_OPT_SET(&opt, EXIT_WITH_STATUS);
1160 + opt.flags.EXIT_WITH_STATUS = 1;
1161 if (!sb)
1162 - DIFF_OPT_SET(&opt, QUICK);
1162 + opt.flags.QUICK = 1;
1163 do_diff_cache(&head, &opt);
1164 diffcore_std(&opt);
1165 for (i = 0; sb && i < diff_queued_diff.nr; i++) {
@@ -1409,8 +1409,8 @@ static void write_commit_patch(const struct am_state *state, struct commit *comm
1409 rev_info.show_root_diff = 1;
1410 rev_info.diffopt.output_format = DIFF_FORMAT_PATCH;
1411 rev_info.no_commit_id = 1;
1412 - DIFF_OPT_SET(&rev_info.diffopt, BINARY);
1413 - DIFF_OPT_SET(&rev_info.diffopt, FULL_INDEX);
1412 + rev_info.diffopt.flags.BINARY = 1;
1413 + rev_info.diffopt.flags.FULL_INDEX = 1;
1414 rev_info.diffopt.use_color = 0;
1415 rev_info.diffopt.file = fp;
1416 rev_info.diffopt.close_file = 1;
builtin/blame.c
+2 -2
@@ -708,8 +708,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
708 git_config(git_blame_config, &output_option);
709 init_revisions(&revs, NULL);
710 revs.date_mode = blame_date_mode;
711 - DIFF_OPT_SET(&revs.diffopt, ALLOW_TEXTCONV);
712 - DIFF_OPT_SET(&revs.diffopt, FOLLOW_RENAMES);
711 + revs.diffopt.flags.ALLOW_TEXTCONV = 1;
712 + revs.diffopt.flags.FOLLOW_RENAMES = 1;
713
714 save_commit_buffer = 0;
715 dashdash_pos = 0;
builtin/diff.c
+3 -3
@@ -350,8 +350,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
350 rev.diffopt.stat_graph_width = -1;
351
352 /* Default to let external and textconv be used */
353 - DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
354 - DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
353 + rev.diffopt.flags.ALLOW_EXTERNAL = 1;
354 + rev.diffopt.flags.ALLOW_TEXTCONV = 1;
355
356 if (nongit)
357 die(_("Not a git repository"));
@@ -361,7 +361,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
361 diff_setup_done(&rev.diffopt);
362 }
363
364 - DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
364 + rev.diffopt.flags.RECURSIVE = 1;
365
366 setup_diff_pager(&rev.diffopt);
367
builtin/fast-export.c
+1 -1
@@ -1066,7 +1066,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
1066 die("revision walk setup failed");
1067 revs.diffopt.format_callback = show_filemodify;
1068 revs.diffopt.format_callback_data = &paths_of_changed_objects;
1069 - DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
1069 + revs.diffopt.flags.RECURSIVE = 1;
1070 while ((commit = get_revision(&revs))) {
1071 if (has_unshown_parent(commit)) {
1072 add_object_array(&commit->object, NULL, &commits);
builtin/log.c
+7 -7
@@ -121,16 +121,16 @@ static void cmd_log_init_defaults(struct rev_info *rev)
121 if (fmt_pretty)
122 get_commit_format(fmt_pretty, rev);
123 if (default_follow)
124 - DIFF_OPT_SET(&rev->diffopt, DEFAULT_FOLLOW_RENAMES);
124 + rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES = 1;
125 rev->verbose_header = 1;
126 - DIFF_OPT_SET(&rev->diffopt, RECURSIVE);
126 + rev->diffopt.flags.RECURSIVE = 1;
127 rev->diffopt.stat_width = -1; /* use full terminal width */
128 rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
129 rev->abbrev_commit = default_abbrev_commit;
130 rev->show_root_diff = default_show_root;
131 rev->subject_prefix = fmt_patch_subject_prefix;
132 rev->show_signature = default_show_signature;
133 - DIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);
133 + rev->diffopt.flags.ALLOW_TEXTCONV = 1;
134
135 if (default_date_mode)
136 parse_date_format(default_date_mode, &rev->date_mode);
@@ -668,7 +668,7 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
668 {
669 if (rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES &&
670 rev->prune_data.nr == 1)
671 - DIFF_OPT_SET(&rev->diffopt, FOLLOW_RENAMES);
671 + rev->diffopt.flags.FOLLOW_RENAMES = 1;
672
673 /* Turn --cc/-c into -p --cc/-c when -p was not given */
674 if (!rev->diffopt.output_format && rev->combine_merges)
@@ -1340,7 +1340,7 @@ static void prepare_bases(struct base_tree_info *bases,
1340 return;
1341
1342 diff_setup(&diffopt);
1343 - DIFF_OPT_SET(&diffopt, RECURSIVE);
1343 + diffopt.flags.RECURSIVE = 1;
1344 diff_setup_done(&diffopt);
1345
1346 oidcpy(&bases->base_commit, &base->object.oid);
@@ -1511,7 +1511,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
1511 rev.verbose_header = 1;
1512 rev.diff = 1;
1513 rev.max_parents = 1;
1514 - DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
1514 + rev.diffopt.flags.RECURSIVE = 1;
1515 rev.subject_prefix = fmt_patch_subject_prefix;
1516 memset(&s_r_opt, 0, sizeof(s_r_opt));
1517 s_r_opt.def = "HEAD";
@@ -1613,7 +1613,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
1613 rev.zero_commit = zero_commit;
1614
1615 if (!rev.diffopt.flags.TEXT && !no_binary_diff)
1616 - DIFF_OPT_SET(&rev.diffopt, BINARY);
1616 + rev.diffopt.flags.BINARY = 1;
1617
1618 if (rev.show_notes)
1619 init_display_notes(&rev.notes_opt);
builtin/reset.c
+1 -1
@@ -166,7 +166,7 @@ static int read_from_tree(const struct pathspec *pathspec,
166 opt.output_format = DIFF_FORMAT_CALLBACK;
167 opt.format_callback = update_index_from_diff;
168 opt.format_callback_data = &intent_to_add;
169 - DIFF_OPT_SET(&opt, OVERRIDE_SUBMODULE_CONFIG);
169 + opt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
170
171 if (do_diff_cache(tree_oid, &opt))
172 return 1;
combine-diff.c
+1 -1
@@ -1413,7 +1413,7 @@ void diff_tree_combined(const struct object_id *oid,
1413
1414 diffopts = *opt;
1415 copy_pathspec(&diffopts.pathspec, &opt->pathspec);
1416 - DIFF_OPT_SET(&diffopts, RECURSIVE);
1416 + diffopts.flags.RECURSIVE = 1;
1417 DIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL);
1418
1419 /* find set of paths that everybody touches
diff-lib.c
+2 -2
@@ -545,8 +545,8 @@ int index_differs_from(const char *def, const struct diff_flags *flags,
545 memset(&opt, 0, sizeof(opt));
546 opt.def = def;
547 setup_revisions(0, NULL, &rev, &opt);
548 - DIFF_OPT_SET(&rev.diffopt, QUICK);
549 - DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS);
548 + rev.diffopt.flags.QUICK = 1;
549 + rev.diffopt.flags.EXIT_WITH_STATUS = 1;
550 if (flags)
551 diff_flags_or(&rev.diffopt.flags, flags);
552 rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
diff-no-index.c
+3 -3
@@ -276,16 +276,16 @@ void diff_no_index(struct rev_info *revs,
276 if (!revs->diffopt.output_format)
277 revs->diffopt.output_format = DIFF_FORMAT_PATCH;
278
279 - DIFF_OPT_SET(&revs->diffopt, NO_INDEX);
279 + revs->diffopt.flags.NO_INDEX = 1;
280
281 - DIFF_OPT_SET(&revs->diffopt, RELATIVE_NAME);
281 + revs->diffopt.flags.RELATIVE_NAME = 1;
282 revs->diffopt.prefix = prefix;
283
284 revs->max_count = -2;
285 diff_setup_done(&revs->diffopt);
286
287 setup_diff_pager(&revs->diffopt);
288 - DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
288 + revs->diffopt.flags.EXIT_WITH_STATUS = 1;
289
290 if (queue_diff(&revs->diffopt, paths[0], paths[1]))
291 exit(1);
diff.c
+33 -33
@@ -127,15 +127,15 @@ static int parse_dirstat_params(struct diff_options *options, const char *params
127 DIFF_OPT_CLR(options, DIRSTAT_BY_LINE);
128 DIFF_OPT_CLR(options, DIRSTAT_BY_FILE);
129 } else if (!strcmp(p, "lines")) {
130 - DIFF_OPT_SET(options, DIRSTAT_BY_LINE);
130 + options->flags.DIRSTAT_BY_LINE = 1;
131 DIFF_OPT_CLR(options, DIRSTAT_BY_FILE);
132 } else if (!strcmp(p, "files")) {
133 DIFF_OPT_CLR(options, DIRSTAT_BY_LINE);
134 - DIFF_OPT_SET(options, DIRSTAT_BY_FILE);
134 + options->flags.DIRSTAT_BY_FILE = 1;
135 } else if (!strcmp(p, "noncumulative")) {
136 DIFF_OPT_CLR(options, DIRSTAT_CUMULATIVE);
137 } else if (!strcmp(p, "cumulative")) {
138 - DIFF_OPT_SET(options, DIRSTAT_CUMULATIVE);
138 + options->flags.DIRSTAT_CUMULATIVE = 1;
139 } else if (isdigit(*p)) {
140 char *end;
141 int permille = strtoul(p, &end, 10) * 10;
@@ -3447,7 +3447,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
3447 diff_free_filespec_data(one);
3448 diff_free_filespec_data(two);
3449 if (data.status)
3450 - DIFF_OPT_SET(o, CHECK_FAILED);
3450 + o->flags.CHECK_FAILED = 1;
3451 }
3452
3453 struct diff_filespec *alloc_filespec(const char *path)
@@ -4152,7 +4152,7 @@ void diff_setup(struct diff_options *options)
4152 options->context = diff_context_default;
4153 options->interhunkcontext = diff_interhunk_context_default;
4154 options->ws_error_highlight = ws_error_highlight_default;
4155 - DIFF_OPT_SET(options, RENAME_EMPTY);
4155 + options->flags.RENAME_EMPTY = 1;
4156
4157 /* pathchange left =NULL by default */
4158 options->change = diff_change;
@@ -4203,7 +4203,7 @@ void diff_setup_done(struct diff_options *options)
4203 if (DIFF_XDL_TST(options, IGNORE_WHITESPACE) ||
4204 DIFF_XDL_TST(options, IGNORE_WHITESPACE_CHANGE) ||
4205 DIFF_XDL_TST(options, IGNORE_WHITESPACE_AT_EOL))
4206 - DIFF_OPT_SET(options, DIFF_FROM_CONTENTS);
4206 + options->flags.DIFF_FROM_CONTENTS = 1;
4207 else
4208 DIFF_OPT_CLR(options, DIFF_FROM_CONTENTS);
4209
@@ -4240,18 +4240,18 @@ void diff_setup_done(struct diff_options *options)
4240 DIFF_FORMAT_DIRSTAT |
4241 DIFF_FORMAT_SUMMARY |
4242 DIFF_FORMAT_CHECKDIFF))
4243 - DIFF_OPT_SET(options, RECURSIVE);
4243 + options->flags.RECURSIVE = 1;
4244 /*
4245 * Also pickaxe would not work very well if you do not say recursive
4246 */
4247 if (options->pickaxe)
4248 - DIFF_OPT_SET(options, RECURSIVE);
4248 + options->flags.RECURSIVE = 1;
4249 /*
4250 * When patches are generated, submodules diffed against the work tree
4251 * must be checked for dirtiness too so it can be shown in the output
4252 */
4253 if (options->output_format & DIFF_FORMAT_PATCH)
4254 - DIFF_OPT_SET(options, DIRTY_SUBMODULES);
4254 + options->flags.DIRTY_SUBMODULES = 1;
4255
4256 if (options->detect_rename && options->rename_limit < 0)
4257 options->rename_limit = diff_rename_limit_default;
@@ -4275,7 +4275,7 @@ void diff_setup_done(struct diff_options *options)
4275 */
4276 if (options->flags.QUICK) {
4277 options->output_format = DIFF_FORMAT_NO_OUTPUT;
4278 - DIFF_OPT_SET(options, EXIT_WITH_STATUS);
4278 + options->flags.EXIT_WITH_STATUS = 1;
4279 }
4280
4281 options->diff_path_counter = 0;
@@ -4630,7 +4630,7 @@ int diff_opt_parse(struct diff_options *options,
4630 else if (starts_with(arg, "-C") || starts_with(arg, "--find-copies=") ||
4631 !strcmp(arg, "--find-copies")) {
4632 if (options->detect_rename == DIFF_DETECT_COPY)
4633 - DIFF_OPT_SET(options, FIND_COPIES_HARDER);
4633 + options->flags.FIND_COPIES_HARDER = 1;
4634 if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
4635 return error("invalid argument to -C: %s", arg+2);
4636 options->detect_rename = DIFF_DETECT_COPY;
@@ -4638,13 +4638,13 @@ int diff_opt_parse(struct diff_options *options,
4638 else if (!strcmp(arg, "--no-renames"))
4639 options->detect_rename = 0;
4640 else if (!strcmp(arg, "--rename-empty"))
4641 - DIFF_OPT_SET(options, RENAME_EMPTY);
4641 + options->flags.RENAME_EMPTY = 1;
4642 else if (!strcmp(arg, "--no-rename-empty"))
4643 DIFF_OPT_CLR(options, RENAME_EMPTY);
4644 else if (!strcmp(arg, "--relative"))
4645 - DIFF_OPT_SET(options, RELATIVE_NAME);
4645 + options->flags.RELATIVE_NAME = 1;
4646 else if (skip_prefix(arg, "--relative=", &arg)) {
4647 - DIFF_OPT_SET(options, RELATIVE_NAME);
4647 + options->flags.RELATIVE_NAME = 1;
4648 options->prefix = arg;
4649 }
4650
@@ -4684,18 +4684,18 @@ int diff_opt_parse(struct diff_options *options,
4684 /* flags options */
4685 else if (!strcmp(arg, "--binary")) {
4686 enable_patch_output(&options->output_format);
4687 - DIFF_OPT_SET(options, BINARY);
4687 + options->flags.BINARY = 1;
4688 }
4689 else if (!strcmp(arg, "--full-index"))
4690 - DIFF_OPT_SET(options, FULL_INDEX);
4690 + options->flags.FULL_INDEX = 1;
4691 else if (!strcmp(arg, "-a") || !strcmp(arg, "--text"))
4692 - DIFF_OPT_SET(options, TEXT);
4692 + options->flags.TEXT = 1;
4693 else if (!strcmp(arg, "-R"))
4694 - DIFF_OPT_SET(options, REVERSE_DIFF);
4694 + options->flags.REVERSE_DIFF = 1;
4695 else if (!strcmp(arg, "--find-copies-harder"))
4696 - DIFF_OPT_SET(options, FIND_COPIES_HARDER);
4696 + options->flags.FIND_COPIES_HARDER = 1;
4697 else if (!strcmp(arg, "--follow"))
4698 - DIFF_OPT_SET(options, FOLLOW_RENAMES);
4698 + options->flags.FOLLOW_RENAMES = 1;
4699 else if (!strcmp(arg, "--no-follow")) {
4700 DIFF_OPT_CLR(options, FOLLOW_RENAMES);
4701 DIFF_OPT_CLR(options, DEFAULT_FOLLOW_RENAMES);
@@ -4755,23 +4755,23 @@ int diff_opt_parse(struct diff_options *options,
4755 return argcount;
4756 }
4757 else if (!strcmp(arg, "--exit-code"))
4758 - DIFF_OPT_SET(options, EXIT_WITH_STATUS);
4758 + options->flags.EXIT_WITH_STATUS = 1;
4759 else if (!strcmp(arg, "--quiet"))
4760 - DIFF_OPT_SET(options, QUICK);
4760 + options->flags.QUICK = 1;
4761 else if (!strcmp(arg, "--ext-diff"))
4762 - DIFF_OPT_SET(options, ALLOW_EXTERNAL);
4762 + options->flags.ALLOW_EXTERNAL = 1;
4763 else if (!strcmp(arg, "--no-ext-diff"))
4764 DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
4765 else if (!strcmp(arg, "--textconv")) {
4766 - DIFF_OPT_SET(options, ALLOW_TEXTCONV);
4767 - DIFF_OPT_SET(options, TEXTCONV_SET_VIA_CMDLINE);
4766 + options->flags.ALLOW_TEXTCONV = 1;
4767 + options->flags.TEXTCONV_SET_VIA_CMDLINE = 1;
4768 } else if (!strcmp(arg, "--no-textconv"))
4769 DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
4770 else if (!strcmp(arg, "--ignore-submodules")) {
4771 - DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
4771 + options->flags.OVERRIDE_SUBMODULE_CONFIG = 1;
4772 handle_ignore_submodules_arg(options, "all");
4773 } else if (skip_prefix(arg, "--ignore-submodules=", &arg)) {
4774 - DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
4774 + options->flags.OVERRIDE_SUBMODULE_CONFIG = 1;
4775 handle_ignore_submodules_arg(options, arg);
4776 } else if (!strcmp(arg, "--submodule"))
4777 options->submodule_format = DIFF_SUBMODULE_LOG;
@@ -4846,9 +4846,9 @@ int diff_opt_parse(struct diff_options *options,
4846 &options->interhunkcontext))
4847 ;
4848 else if (!strcmp(arg, "-W"))
4849 - DIFF_OPT_SET(options, FUNCCONTEXT);
4849 + options->flags.FUNCCONTEXT = 1;
4850 else if (!strcmp(arg, "--function-context"))
4851 - DIFF_OPT_SET(options, FUNCCONTEXT);
4851 + options->flags.FUNCCONTEXT = 1;
4852 else if (!strcmp(arg, "--no-function-context"))
4853 DIFF_OPT_CLR(options, FUNCCONTEXT);
4854 else if ((argcount = parse_long_opt("output", av, &optarg))) {
@@ -5686,7 +5686,7 @@ free_queue:
5686 */
5687 if (options->flags.DIFF_FROM_CONTENTS) {
5688 if (options->found_changes)
5689 - DIFF_OPT_SET(options, HAS_CHANGES);
5689 + options->flags.HAS_CHANGES = 1;
5690 else
5691 DIFF_OPT_CLR(options, HAS_CHANGES);
5692 }
@@ -5858,7 +5858,7 @@ void diffcore_std(struct diff_options *options)
5858 diffcore_apply_filter(options);
5859
5860 if (diff_queued_diff.nr && !options->flags.DIFF_FROM_CONTENTS)
5861 - DIFF_OPT_SET(options, HAS_CHANGES);
5861 + options->flags.HAS_CHANGES = 1;
5862 else
5863 DIFF_OPT_CLR(options, HAS_CHANGES);
5864
@@ -5952,7 +5952,7 @@ void diff_addremove(struct diff_options *options,
5952
5953 diff_queue(&diff_queued_diff, one, two);
5954 if (!options->flags.DIFF_FROM_CONTENTS)
5955 - DIFF_OPT_SET(options, HAS_CHANGES);
5955 + options->flags.HAS_CHANGES = 1;
5956 }
5957
5958 void diff_change(struct diff_options *options,
@@ -5996,7 +5996,7 @@ void diff_change(struct diff_options *options,
5996 !diff_filespec_check_stat_unmatch(p))
5997 return;
5998
5999 - DIFF_OPT_SET(options, HAS_CHANGES);
5999 + options->flags.HAS_CHANGES = 1;
6000 }
6001
6002 struct diff_filepair *diff_unmerge(struct diff_options *options, const char *path)
diff.h
-1
@@ -106,7 +106,6 @@ static inline void diff_flags_or(struct diff_flags *a,
106 tmp_a[i] |= tmp_b[i];
107 }
108
109 -#define DIFF_OPT_SET(opts, flag) ((opts)->flags.flag = 1)
109 #define DIFF_OPT_CLR(opts, flag) ((opts)->flags.flag = 0)
110
111 #define DIFF_XDL_TST(opts, flag) ((opts)->xdl_opts & XDF_##flag)
merge-recursive.c
+1 -1
@@ -540,7 +540,7 @@ static struct string_list *get_renames(struct merge_options *o,
540 return renames;
541
542 diff_setup(&opts);
543 - DIFF_OPT_SET(&opts, RECURSIVE);
543 + opts.flags.RECURSIVE = 1;
544 DIFF_OPT_CLR(&opts, RENAME_EMPTY);
545 opts.detect_rename = DIFF_DETECT_RENAME;
546 opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
notes-merge.c
+2 -2
@@ -125,7 +125,7 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
125 oid_to_hex(base), oid_to_hex(remote));
126
127 diff_setup(&opt);
128 - DIFF_OPT_SET(&opt, RECURSIVE);
128 + opt.flags.RECURSIVE = 1;
129 opt.output_format = DIFF_FORMAT_NO_OUTPUT;
130 diff_setup_done(&opt);
131 diff_tree_oid(base, remote, "", &opt);
@@ -188,7 +188,7 @@ static void diff_tree_local(struct notes_merge_options *o,
188 len, oid_to_hex(base), oid_to_hex(local));
189
190 diff_setup(&opt);
191 - DIFF_OPT_SET(&opt, RECURSIVE);
191 + opt.flags.RECURSIVE = 1;
192 opt.output_format = DIFF_FORMAT_NO_OUTPUT;
193 diff_setup_done(&opt);
194 diff_tree_oid(base, local, "", &opt);
patch-ids.c
+1 -1
@@ -61,7 +61,7 @@ int init_patch_ids(struct patch_ids *ids)
61 memset(ids, 0, sizeof(*ids));
62 diff_setup(&ids->diffopts);
63 ids->diffopts.detect_rename = 0;
64 - DIFF_OPT_SET(&ids->diffopts, RECURSIVE);
64 + ids->diffopts.flags.RECURSIVE = 1;
65 diff_setup_done(&ids->diffopts);
66 hashmap_init(&ids->patches, patch_id_cmp, &ids->diffopts, 256);
67 return 0;
revision.c
+8 -8
@@ -410,7 +410,7 @@ static void file_add_remove(struct diff_options *options,
410
411 tree_difference |= diff;
412 if (tree_difference == REV_TREE_DIFFERENT)
413 - DIFF_OPT_SET(options, HAS_CHANGES);
413 + options->flags.HAS_CHANGES = 1;
414 }
415
416 static void file_change(struct diff_options *options,
@@ -422,7 +422,7 @@ static void file_change(struct diff_options *options,
422 unsigned old_dirty_submodule, unsigned new_dirty_submodule)
423 {
424 tree_difference = REV_TREE_DIFFERENT;
425 - DIFF_OPT_SET(options, HAS_CHANGES);
425 + options->flags.HAS_CHANGES = 1;
426 }
427
428 static int rev_compare_tree(struct rev_info *revs,
@@ -1403,8 +1403,8 @@ void init_revisions(struct rev_info *revs, const char *prefix)
1403 revs->abbrev = DEFAULT_ABBREV;
1404 revs->ignore_merges = 1;
1405 revs->simplify_history = 1;
1406 - DIFF_OPT_SET(&revs->pruning, RECURSIVE);
1407 - DIFF_OPT_SET(&revs->pruning, QUICK);
1406 + revs->pruning.flags.RECURSIVE = 1;
1407 + revs->pruning.flags.QUICK = 1;
1408 revs->pruning.add_remove = file_add_remove;
1409 revs->pruning.change = file_change;
1410 revs->sort_order = REV_SORT_IN_GRAPH_ORDER;
@@ -1917,11 +1917,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
1917 die("--unpacked=<packfile> no longer supported.");
1918 } else if (!strcmp(arg, "-r")) {
1919 revs->diff = 1;
1920 - DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
1920 + revs->diffopt.flags.RECURSIVE = 1;
1921 } else if (!strcmp(arg, "-t")) {
1922 revs->diff = 1;
1923 - DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
1924 - DIFF_OPT_SET(&revs->diffopt, TREE_IN_RECURSIVE);
1923 + revs->diffopt.flags.RECURSIVE = 1;
1924 + revs->diffopt.flags.TREE_IN_RECURSIVE = 1;
1925 } else if (!strcmp(arg, "-m")) {
1926 revs->ignore_merges = 0;
1927 } else if (!strcmp(arg, "-c")) {
@@ -2066,7 +2066,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
2066 revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_ERE;
2067 } else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
2068 revs->grep_filter.ignore_case = 1;
2069 - DIFF_OPT_SET(&revs->diffopt, PICKAXE_IGNORE_CASE);
2069 + revs->diffopt.flags.PICKAXE_IGNORE_CASE = 1;
2070 } else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
2071 revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_FIXED;
2072 } else if (!strcmp(arg, "--perl-regexp") || !strcmp(arg, "-P")) {
submodule.c
+4 -4
@@ -183,7 +183,7 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
183 if (ignore)
184 handle_ignore_submodules_arg(diffopt, ignore);
185 else if (is_gitmodules_unmerged(&the_index))
186 - DIFF_OPT_SET(diffopt, IGNORE_SUBMODULES);
186 + diffopt->flags.IGNORE_SUBMODULES = 1;
187 }
188 }
189
@@ -407,11 +407,11 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
407 DIFF_OPT_CLR(diffopt, IGNORE_DIRTY_SUBMODULES);
408
409 if (!strcmp(arg, "all"))
410 - DIFF_OPT_SET(diffopt, IGNORE_SUBMODULES);
410 + diffopt->flags.IGNORE_SUBMODULES = 1;
411 else if (!strcmp(arg, "untracked"))
412 - DIFF_OPT_SET(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);
412 + diffopt->flags.IGNORE_UNTRACKED_IN_SUBMODULES = 1;
413 else if (!strcmp(arg, "dirty"))
414 - DIFF_OPT_SET(diffopt, IGNORE_DIRTY_SUBMODULES);
414 + diffopt->flags.IGNORE_DIRTY_SUBMODULES = 1;
415 else if (strcmp(arg, "none"))
416 die("bad --ignore-submodules argument: %s", arg);
417 }
tree-diff.c
+2 -2
@@ -608,8 +608,8 @@ static void try_to_follow_renames(const struct object_id *old_oid,
608 q->nr = 0;
609
610 diff_setup(&diff_opts);
611 - DIFF_OPT_SET(&diff_opts, RECURSIVE);
612 - DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
611 + diff_opts.flags.RECURSIVE = 1;
612 + diff_opts.flags.FIND_COPIES_HARDER = 1;
613 diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
614 diff_opts.single_follow = opt->pathspec.items[0].match;
615 diff_opts.break_opt = opt->break_opt;
wt-status.c
+9 -9
@@ -559,12 +559,12 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
559 init_revisions(&rev, NULL);
560 setup_revisions(0, NULL, &rev, NULL);
561 rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
562 - DIFF_OPT_SET(&rev.diffopt, DIRTY_SUBMODULES);
562 + rev.diffopt.flags.DIRTY_SUBMODULES = 1;
563 rev.diffopt.ita_invisible_in_index = 1;
564 if (!s->show_untracked_files)
565 - DIFF_OPT_SET(&rev.diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);
565 + rev.diffopt.flags.IGNORE_UNTRACKED_IN_SUBMODULES = 1;
566 if (s->ignore_submodule_arg) {
567 - DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
567 + rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
568 handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
569 }
570 rev.diffopt.format_callback = wt_status_collect_changed_cb;
@@ -583,7 +583,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)
583 opt.def = s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference;
584 setup_revisions(0, NULL, &rev, &opt);
585
586 - DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
586 + rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
587 rev.diffopt.ita_invisible_in_index = 1;
588 if (s->ignore_submodule_arg) {
589 handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
@@ -949,7 +949,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s)
949 const char *c = color(WT_STATUS_HEADER, s);
950
951 init_revisions(&rev, NULL);
952 - DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
952 + rev.diffopt.flags.ALLOW_TEXTCONV = 1;
953 rev.diffopt.ita_invisible_in_index = 1;
954
955 memset(&opt, 0, sizeof(opt));
@@ -2263,8 +2263,8 @@ int has_unstaged_changes(int ignore_submodules)
2263
2264 init_revisions(&rev_info, NULL);
2265 if (ignore_submodules)
2266 - DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
2267 - DIFF_OPT_SET(&rev_info.diffopt, QUICK);
2266 + rev_info.diffopt.flags.IGNORE_SUBMODULES = 1;
2267 + rev_info.diffopt.flags.QUICK = 1;
2268 diff_setup_done(&rev_info.diffopt);
2269 result = run_diff_files(&rev_info, 0);
2270 return diff_result_code(&rev_info.diffopt, result);
@@ -2283,8 +2283,8 @@ int has_uncommitted_changes(int ignore_submodules)
2283
2284 init_revisions(&rev_info, NULL);
2285 if (ignore_submodules)
2286 - DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
2287 - DIFF_OPT_SET(&rev_info.diffopt, QUICK);
2286 + rev_info.diffopt.flags.IGNORE_SUBMODULES = 1;
2287 + rev_info.diffopt.flags.QUICK = 1;
2288 add_head_to_pending(&rev_info);
2289 diff_setup_done(&rev_info.diffopt);
2290 result = run_diff_index(&rev_info, 1);