diff: make struct diff_flags members lowercase

Now that the flags stored in struct diff_flags are being accessed directly and not through macros, change all struct members from being uppercase to lowercase. This conversion is done using the following semantic patch: @@ expression E; @@ - E.RECURSIVE + E.recursive @@ expression E; @@ - E.TREE_IN_RECURSIVE + E.tree_in_recursive @@ expression E; @@ - E.BINARY + E.binary @@ expression E; @@ - E.TEXT + E.text @@ expression E; @@ - E.FULL_INDEX + E.full_index @@ expression E; @@ - E.SILENT_ON_REMOVE + E.silent_on_remove @@ expression E; @@ - E.FIND_COPIES_HARDER + E.find_copies_harder @@ expression E; @@ - E.FOLLOW_RENAMES + E.follow_renames @@ expression E; @@ - E.RENAME_EMPTY + E.rename_empty @@ expression E; @@ - E.HAS_CHANGES + E.has_changes @@ expression E; @@ - E.QUICK + E.quick @@ expression E; @@ - E.NO_INDEX + E.no_index @@ expression E; @@ - E.ALLOW_EXTERNAL + E.allow_external @@ expression E; @@ - E.EXIT_WITH_STATUS + E.exit_with_status @@ expression E; @@ - E.REVERSE_DIFF + E.reverse_diff @@ expression E; @@ - E.CHECK_FAILED + E.check_failed @@ expression E; @@ - E.RELATIVE_NAME + E.relative_name @@ expression E; @@ - E.IGNORE_SUBMODULES + E.ignore_submodules @@ expression E; @@ - E.DIRSTAT_CUMULATIVE + E.dirstat_cumulative @@ expression E; @@ - E.DIRSTAT_BY_FILE + E.dirstat_by_file @@ expression E; @@ - E.ALLOW_TEXTCONV + E.allow_textconv @@ expression E; @@ - E.TEXTCONV_SET_VIA_CMDLINE + E.textconv_set_via_cmdline @@ expression E; @@ - E.DIFF_FROM_CONTENTS + E.diff_from_contents @@ expression E; @@ - E.DIRTY_SUBMODULES + E.dirty_submodules @@ expression E; @@ - E.IGNORE_UNTRACKED_IN_SUBMODULES + E.ignore_untracked_in_submodules @@ expression E; @@ - E.IGNORE_DIRTY_SUBMODULES + E.ignore_dirty_submodules @@ expression E; @@ - E.OVERRIDE_SUBMODULE_CONFIG + E.override_submodule_config @@ expression E; @@ - E.DIRSTAT_BY_LINE + E.dirstat_by_line @@ expression E; @@ - E.FUNCCONTEXT + E.funccontext @@ expression E; @@ - E.PICKAXE_IGNORE_CASE + E.pickaxe_ignore_case @@ expression E; @@ - E.DEFAULT_FOLLOW_RENAMES + E.default_follow_renames 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 0d1e0e7801bb2ae22036ad09f9f5cec17e08c48b
25 files changed +228 -228
blame.c
+8 -8
@@ -209,7 +209,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
209
210 switch (st.st_mode & S_IFMT) {
211 case S_IFREG:
212 - if (opt->flags.ALLOW_TEXTCONV &&
212 + if (opt->flags.allow_textconv &&
213 textconv_object(read_from, mode, &null_oid, 0, &buf_ptr, &buf_len))
214 strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1);
215 else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size)
@@ -293,7 +293,7 @@ static void fill_origin_blob(struct diff_options *opt,
293 unsigned long file_size;
294
295 (*num_read_blob)++;
296 - if (opt->flags.ALLOW_TEXTCONV &&
296 + if (opt->flags.allow_textconv &&
297 textconv_object(o->path, o->mode, &o->blob_oid, 1, &file->ptr, &file_size))
298 ;
299 else
@@ -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_opts.flags.RECURSIVE = 1;
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_opts.flags.RECURSIVE = 1;
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_opts.flags.RECURSIVE = 1;
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_opts.flags.FIND_COPIES_HARDER = 1;
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);
@@ -1262,7 +1262,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
1262 &target->commit->tree->object.oid,
1263 "", &diff_opts);
1264
1265 - if (!diff_opts.flags.FIND_COPIES_HARDER)
1265 + if (!diff_opts.flags.find_copies_harder)
1266 diffcore_std(&diff_opts);
1267
1268 do {
@@ -1825,7 +1825,7 @@ void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blam
1825 if (fill_blob_sha1_and_mode(o))
1826 die(_("no such path %s in %s"), path, final_commit_name);
1827
1828 - if (sb->revs->diffopt.flags.ALLOW_TEXTCONV &&
1828 + if (sb->revs->diffopt.flags.allow_textconv &&
1829 textconv_object(path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
1830 &sb->final_buf_size))
1831 ;
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 - rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
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 - rev.diffopt.flags.IGNORE_DIRTY_SUBMODULES = 1;
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
+5 -5
@@ -1157,9 +1157,9 @@ static int index_has_changes(struct strbuf *sb)
1157 struct diff_options opt;
1158
1159 diff_setup(&opt);
1160 - opt.flags.EXIT_WITH_STATUS = 1;
1160 + opt.flags.exit_with_status = 1;
1161 if (!sb)
1162 - opt.flags.QUICK = 1;
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++) {
@@ -1168,7 +1168,7 @@ static int index_has_changes(struct strbuf *sb)
1168 strbuf_addstr(sb, diff_queued_diff.queue[i]->two->path);
1169 }
1170 diff_flush(&opt);
1171 - return opt.flags.HAS_CHANGES != 0;
1171 + return opt.flags.has_changes != 0;
1172 } else {
1173 for (i = 0; sb && i < active_nr; i++) {
1174 if (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 - rev_info.diffopt.flags.BINARY = 1;
1413 - rev_info.diffopt.flags.FULL_INDEX = 1;
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
+5 -5
@@ -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 - revs.diffopt.flags.ALLOW_TEXTCONV = 1;
712 - revs.diffopt.flags.FOLLOW_RENAMES = 1;
711 + revs.diffopt.flags.allow_textconv = 1;
712 + revs.diffopt.flags.follow_renames = 1;
713
714 save_commit_buffer = 0;
715 dashdash_pos = 0;
@@ -734,9 +734,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
734 parse_revision_opt(&revs, &ctx, options, blame_opt_usage);
735 }
736 parse_done:
737 - no_whole_file_rename = !revs.diffopt.flags.FOLLOW_RENAMES;
737 + no_whole_file_rename = !revs.diffopt.flags.follow_renames;
738 xdl_opts |= revs.diffopt.xdl_opts & XDF_INDENT_HEURISTIC;
739 - revs.diffopt.flags.FOLLOW_RENAMES = 0;
739 + revs.diffopt.flags.follow_renames = 0;
740 argc = parse_options_end(&ctx);
741
742 if (incremental || (output_option & OUTPUT_PORCELAIN)) {
@@ -803,7 +803,7 @@ parse_done:
803 }
804 blame_date_width -= 1; /* strip the null */
805
806 - if (revs.diffopt.flags.FIND_COPIES_HARDER)
806 + if (revs.diffopt.flags.find_copies_harder)
807 opt |= (PICKAXE_BLAME_COPY | PICKAXE_BLAME_MOVE |
808 PICKAXE_BLAME_COPY_HARDER);
809
builtin/commit.c
+2 -2
@@ -913,10 +913,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
913 * be really confusing.
914 */
915 struct diff_flags flags = DIFF_FLAGS_INIT;
916 - flags.OVERRIDE_SUBMODULE_CONFIG = 1;
916 + flags.override_submodule_config = 1;
917 if (ignore_submodule_arg &&
918 !strcmp(ignore_submodule_arg, "all"))
919 - flags.IGNORE_SUBMODULES = 1;
919 + flags.ignore_submodules = 1;
920 commitable = index_differs_from(parent, &flags, 1);
921 }
922 }
builtin/diff.c
+4 -4
@@ -44,7 +44,7 @@ static void stuff_change(struct diff_options *opt,
44 !oidcmp(old_oid, new_oid) && (old_mode == new_mode))
45 return;
46
47 - if (opt->flags.REVERSE_DIFF) {
47 + if (opt->flags.reverse_diff) {
48 SWAP(old_mode, new_mode);
49 SWAP(old_oid, new_oid);
50 SWAP(old_path, new_path);
@@ -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 - rev.diffopt.flags.ALLOW_EXTERNAL = 1;
354 - rev.diffopt.flags.ALLOW_TEXTCONV = 1;
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 - rev.diffopt.flags.RECURSIVE = 1;
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 - revs.diffopt.flags.RECURSIVE = 1;
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
+13 -13
@@ -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 - rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES = 1;
124 + rev->diffopt.flags.default_follow_renames = 1;
125 rev->verbose_header = 1;
126 - rev->diffopt.flags.RECURSIVE = 1;
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 - rev->diffopt.flags.ALLOW_TEXTCONV = 1;
133 + rev->diffopt.flags.allow_textconv = 1;
134
135 if (default_date_mode)
136 parse_date_format(default_date_mode, &rev->date_mode);
@@ -181,7 +181,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
181 init_display_notes(&rev->notes_opt);
182
183 if (rev->diffopt.pickaxe || rev->diffopt.filter ||
184 - rev->diffopt.flags.FOLLOW_RENAMES)
184 + rev->diffopt.flags.follow_renames)
185 rev->always_show_header = 0;
186
187 if (source)
@@ -391,7 +391,7 @@ static int cmd_log_walk(struct rev_info *rev)
391 fclose(rev->diffopt.file);
392
393 if (rev->diffopt.output_format & DIFF_FORMAT_CHECKDIFF &&
394 - rev->diffopt.flags.CHECK_FAILED) {
394 + rev->diffopt.flags.check_failed) {
395 return 02;
396 }
397 return diff_result_code(&rev->diffopt, 0);
@@ -483,8 +483,8 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c
483 unsigned long size;
484
485 fflush(rev->diffopt.file);
486 - if (!rev->diffopt.flags.TEXTCONV_SET_VIA_CMDLINE ||
487 - !rev->diffopt.flags.ALLOW_TEXTCONV)
486 + if (!rev->diffopt.flags.textconv_set_via_cmdline ||
487 + !rev->diffopt.flags.allow_textconv)
488 return stream_blob_to_fd(1, oid, NULL, 0);
489
490 if (get_oid_with_context(obj_name, GET_OID_RECORD_PATH,
@@ -666,9 +666,9 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
666 static void log_setup_revisions_tweak(struct rev_info *rev,
667 struct setup_revision_opt *opt)
668 {
669 - if (rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES &&
669 + if (rev->diffopt.flags.default_follow_renames &&
670 rev->prune_data.nr == 1)
671 - rev->diffopt.flags.FOLLOW_RENAMES = 1;
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 - diffopt.flags.RECURSIVE = 1;
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 - rev.diffopt.flags.RECURSIVE = 1;
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";
@@ -1612,8 +1612,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
1612
1613 rev.zero_commit = zero_commit;
1614
1615 - if (!rev.diffopt.flags.TEXT && !no_binary_diff)
1616 - rev.diffopt.flags.BINARY = 1;
1615 + if (!rev.diffopt.flags.text && !no_binary_diff)
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 - opt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
169 + opt.flags.override_submodule_config = 1;
170
171 if (do_diff_cache(tree_oid, &opt))
172 return 1;
builtin/rev-list.c
+1 -1
@@ -294,7 +294,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
294 if (revs.bisect)
295 bisect_list = 1;
296
297 - if (revs.diffopt.flags.QUICK)
297 + if (revs.diffopt.flags.quick)
298 info.flags |= REV_LIST_QUIET;
299 for (i = 1 ; i < argc; i++) {
300 const char *arg = argv[i];
combine-diff.c
+5 -5
@@ -898,7 +898,7 @@ static void show_combined_header(struct combine_diff_path *elem,
898 int show_file_header)
899 {
900 struct diff_options *opt = &rev->diffopt;
901 - int abbrev = opt->flags.FULL_INDEX ? GIT_SHA1_HEXSZ : DEFAULT_ABBREV;
901 + int abbrev = opt->flags.full_index ? GIT_SHA1_HEXSZ : DEFAULT_ABBREV;
902 const char *a_prefix = opt->a_prefix ? opt->a_prefix : "a/";
903 const char *b_prefix = opt->b_prefix ? opt->b_prefix : "b/";
904 const char *c_meta = diff_get_color_opt(opt, DIFF_METAINFO);
@@ -987,7 +987,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
987 userdiff = userdiff_find_by_path(elem->path);
988 if (!userdiff)
989 userdiff = userdiff_find_by_name("default");
990 - if (opt->flags.ALLOW_TEXTCONV)
990 + if (opt->flags.allow_textconv)
991 textconv = userdiff_get_textconv(userdiff);
992
993 /* Read the result of merge first */
@@ -1413,8 +1413,8 @@ void diff_tree_combined(const struct object_id *oid,
1413
1414 diffopts = *opt;
1415 copy_pathspec(&diffopts.pathspec, &opt->pathspec);
1416 - diffopts.flags.RECURSIVE = 1;
1417 - diffopts.flags.ALLOW_EXTERNAL = 0;
1416 + diffopts.flags.recursive = 1;
1417 + diffopts.flags.allow_external = 0;
1418
1419 /* find set of paths that everybody touches
1420 *
@@ -1435,7 +1435,7 @@ void diff_tree_combined(const struct object_id *oid,
1435 * NOTE please keep this semantically in sync with diffcore_std()
1436 */
1437 need_generic_pathscan = opt->skip_stat_unmatch ||
1438 - opt->flags.FOLLOW_RENAMES ||
1438 + opt->flags.follow_renames ||
1439 opt->break_opt != -1 ||
1440 opt->detect_rename ||
1441 opt->pickaxe ||
diff-lib.c
+11 -11
@@ -72,14 +72,14 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
72 int changed = ce_match_stat(ce, st, ce_option);
73 if (S_ISGITLINK(ce->ce_mode)) {
74 struct diff_flags orig_flags = diffopt->flags;
75 - if (!diffopt->flags.OVERRIDE_SUBMODULE_CONFIG)
75 + if (!diffopt->flags.override_submodule_config)
76 set_diffopt_flags_from_submodule_config(diffopt, ce->name);
77 - if (diffopt->flags.IGNORE_SUBMODULES)
77 + if (diffopt->flags.ignore_submodules)
78 changed = 0;
79 - else if (!diffopt->flags.IGNORE_DIRTY_SUBMODULES &&
80 - (!changed || diffopt->flags.DIRTY_SUBMODULES))
79 + else if (!diffopt->flags.ignore_dirty_submodules &&
80 + (!changed || diffopt->flags.dirty_submodules))
81 *dirty_submodule = is_submodule_modified(ce->name,
82 - diffopt->flags.IGNORE_UNTRACKED_IN_SUBMODULES);
82 + diffopt->flags.ignore_untracked_in_submodules);
83 diffopt->flags = orig_flags;
84 }
85 return changed;
@@ -229,7 +229,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
229
230 if (!changed && !dirty_submodule) {
231 ce_mark_uptodate(ce);
232 - if (!revs->diffopt.flags.FIND_COPIES_HARDER)
232 + if (!revs->diffopt.flags.find_copies_harder)
233 continue;
234 }
235 oldmode = ce->ce_mode;
@@ -363,7 +363,7 @@ static int show_modified(struct rev_info *revs,
363
364 oldmode = old->ce_mode;
365 if (mode == oldmode && !oidcmp(oid, &old->oid) && !dirty_submodule &&
366 - !revs->diffopt.flags.FIND_COPIES_HARDER)
366 + !revs->diffopt.flags.find_copies_harder)
367 return 0;
368
369 diff_change(&revs->diffopt, oldmode, mode,
@@ -494,7 +494,7 @@ static int diff_cache(struct rev_info *revs,
494 opts.head_idx = 1;
495 opts.index_only = cached;
496 opts.diff_index_cached = (cached &&
497 - !revs->diffopt.flags.FIND_COPIES_HARDER);
497 + !revs->diffopt.flags.find_copies_harder);
498 opts.merge = 1;
499 opts.fn = oneway_diff;
500 opts.unpack_data = revs;
@@ -545,12 +545,12 @@ 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 - rev.diffopt.flags.QUICK = 1;
549 - rev.diffopt.flags.EXIT_WITH_STATUS = 1;
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;
553 run_diff_index(&rev, 1);
554 object_array_clear(&rev.pending);
555 - return (rev.diffopt.flags.HAS_CHANGES != 0);
555 + return (rev.diffopt.flags.has_changes != 0);
556 }
diff-no-index.c
+4 -4
@@ -184,7 +184,7 @@ static int queue_diff(struct diff_options *o,
184 } else {
185 struct diff_filespec *d1, *d2;
186
187 - if (o->flags.REVERSE_DIFF) {
187 + if (o->flags.reverse_diff) {
188 SWAP(mode1, mode2);
189 SWAP(name1, name2);
190 }
@@ -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 - revs->diffopt.flags.NO_INDEX = 1;
279 + revs->diffopt.flags.no_index = 1;
280
281 - revs->diffopt.flags.RELATIVE_NAME = 1;
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 - revs->diffopt.flags.EXIT_WITH_STATUS = 1;
288 + revs->diffopt.flags.exit_with_status = 1;
289
290 if (queue_diff(&revs->diffopt, paths[0], paths[1]))
291 exit(1);
diff.c
+85 -85
@@ -124,18 +124,18 @@ static int parse_dirstat_params(struct diff_options *options, const char *params
124 for (i = 0; i < params.nr; i++) {
125 const char *p = params.items[i].string;
126 if (!strcmp(p, "changes")) {
127 - options->flags.DIRSTAT_BY_LINE = 0;
128 - options->flags.DIRSTAT_BY_FILE = 0;
127 + options->flags.dirstat_by_line = 0;
128 + options->flags.dirstat_by_file = 0;
129 } else if (!strcmp(p, "lines")) {
130 - options->flags.DIRSTAT_BY_LINE = 1;
131 - options->flags.DIRSTAT_BY_FILE = 0;
130 + options->flags.dirstat_by_line = 1;
131 + options->flags.dirstat_by_file = 0;
132 } else if (!strcmp(p, "files")) {
133 - options->flags.DIRSTAT_BY_LINE = 0;
134 - options->flags.DIRSTAT_BY_FILE = 1;
133 + options->flags.dirstat_by_line = 0;
134 + options->flags.dirstat_by_file = 1;
135 } else if (!strcmp(p, "noncumulative")) {
136 - options->flags.DIRSTAT_CUMULATIVE = 0;
136 + options->flags.dirstat_cumulative = 0;
137 } else if (!strcmp(p, "cumulative")) {
138 - options->flags.DIRSTAT_CUMULATIVE = 1;
138 + options->flags.dirstat_cumulative = 1;
139 } else if (isdigit(*p)) {
140 char *end;
141 int permille = strtoul(p, &end, 10) * 10;
@@ -1481,7 +1481,7 @@ static void emit_rewrite_diff(const char *name_a,
1481 struct emit_callback ecbdata;
1482 struct strbuf out = STRBUF_INIT;
1483
1484 - if (diff_mnemonic_prefix && o->flags.REVERSE_DIFF) {
1484 + if (diff_mnemonic_prefix && o->flags.reverse_diff) {
1485 a_prefix = o->b_prefix;
1486 b_prefix = o->a_prefix;
1487 } else {
@@ -2729,7 +2729,7 @@ static void show_dirstat(struct diff_options *options)
2729 dir.alloc = 0;
2730 dir.nr = 0;
2731 dir.permille = options->dirstat_permille;
2732 - dir.cumulative = options->flags.DIRSTAT_CUMULATIVE;
2732 + dir.cumulative = options->flags.dirstat_cumulative;
2733
2734 changed = 0;
2735 for (i = 0; i < q->nr; i++) {
@@ -2755,7 +2755,7 @@ static void show_dirstat(struct diff_options *options)
2755 goto found_damage;
2756 }
2757
2758 - if (options->flags.DIRSTAT_BY_FILE) {
2758 + if (options->flags.dirstat_by_file) {
2759 /*
2760 * In --dirstat-by-file mode, we don't really need to
2761 * look at the actual file contents at all.
@@ -2830,7 +2830,7 @@ static void show_dirstat_by_line(struct diffstat_t *data, struct diff_options *o
2830 dir.alloc = 0;
2831 dir.nr = 0;
2832 dir.permille = options->dirstat_permille;
2833 - dir.cumulative = options->flags.DIRSTAT_CUMULATIVE;
2833 + dir.cumulative = options->flags.dirstat_cumulative;
2834
2835 changed = 0;
2836 for (i = 0; i < data->nr; i++) {
@@ -3117,7 +3117,7 @@ static void builtin_diff(const char *name_a,
3117 const char *line_prefix = diff_line_prefix(o);
3118
3119 diff_set_mnemonic_prefix(o, "a/", "b/");
3120 - if (o->flags.REVERSE_DIFF) {
3120 + if (o->flags.reverse_diff) {
3121 a_prefix = o->b_prefix;
3122 b_prefix = o->a_prefix;
3123 } else {
@@ -3141,7 +3141,7 @@ static void builtin_diff(const char *name_a,
3141 return;
3142 }
3143
3144 - if (o->flags.ALLOW_TEXTCONV) {
3144 + if (o->flags.allow_textconv) {
3145 textconv_one = get_textconv(one);
3146 textconv_two = get_textconv(two);
3147 }
@@ -3201,13 +3201,13 @@ static void builtin_diff(const char *name_a,
3201 header.len, 0);
3202 strbuf_reset(&header);
3203 goto free_ab_and_return;
3204 - } else if (!o->flags.TEXT &&
3204 + } else if (!o->flags.text &&
3205 ( (!textconv_one && diff_filespec_is_binary(one)) ||
3206 (!textconv_two && diff_filespec_is_binary(two)) )) {
3207 struct strbuf sb = STRBUF_INIT;
3208 if (!one->data && !two->data &&
3209 S_ISREG(one->mode) && S_ISREG(two->mode) &&
3210 - !o->flags.BINARY) {
3210 + !o->flags.binary) {
3211 if (!oidcmp(&one->oid, &two->oid)) {
3212 if (must_show_header)
3213 emit_diff_symbol(o, DIFF_SYMBOL_HEADER,
@@ -3236,7 +3236,7 @@ static void builtin_diff(const char *name_a,
3236 }
3237 emit_diff_symbol(o, DIFF_SYMBOL_HEADER, header.buf, header.len, 0);
3238 strbuf_reset(&header);
3239 - if (o->flags.BINARY)
3239 + if (o->flags.binary)
3240 emit_binary_diff(o, &mf1, &mf2);
3241 else {
3242 strbuf_addf(&sb, "%sBinary files %s and %s differ\n",
@@ -3282,7 +3282,7 @@ static void builtin_diff(const char *name_a,
3282 xecfg.ctxlen = o->context;
3283 xecfg.interhunkctxlen = o->interhunkcontext;
3284 xecfg.flags = XDL_EMIT_FUNCNAMES;
3285 - if (o->flags.FUNCCONTEXT)
3285 + if (o->flags.funccontext)
3286 xecfg.flags |= XDL_EMIT_FUNCCONTEXT;
3287 if (pe)
3288 xdiff_set_find_func(&xecfg, pe->pattern, pe->cflags);
@@ -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 - o->flags.CHECK_FAILED = 1;
3450 + o->flags.check_failed = 1;
3451 }
3452
3453 struct diff_filespec *alloc_filespec(const char *path)
@@ -3941,9 +3941,9 @@ static void fill_metainfo(struct strbuf *msg,
3941 *must_show_header = 0;
3942 }
3943 if (one && two && oidcmp(&one->oid, &two->oid)) {
3944 - int abbrev = o->flags.FULL_INDEX ? 40 : DEFAULT_ABBREV;
3944 + int abbrev = o->flags.full_index ? 40 : DEFAULT_ABBREV;
3945
3946 - if (o->flags.BINARY) {
3946 + if (o->flags.binary) {
3947 mmfile_t mf;
3948 if ((!fill_mmfile(&mf, one) && diff_filespec_is_binary(one)) ||
3949 (!fill_mmfile(&mf, two) && diff_filespec_is_binary(two)))
@@ -3973,7 +3973,7 @@ static void run_diff_cmd(const char *pgm,
3973 int must_show_header = 0;
3974
3975
3976 - if (o->flags.ALLOW_EXTERNAL) {
3976 + if (o->flags.allow_external) {
3977 struct userdiff_driver *drv = userdiff_find_by_path(attr_path);
3978 if (drv && drv->external)
3979 pgm = drv->external;
@@ -4053,7 +4053,7 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o)
4053 if (o->prefix_length)
4054 strip_prefix(o->prefix_length, &name, &other);
4055
4056 - if (!o->flags.ALLOW_EXTERNAL)
4056 + if (!o->flags.allow_external)
4057 pgm = NULL;
4058
4059 if (DIFF_PAIR_UNMERGED(p)) {
@@ -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 - options->flags.RENAME_EMPTY = 1;
4155 + options->flags.rename_empty = 1;
4156
4157 /* pathchange left =NULL by default */
4158 options->change = diff_change;
@@ -4203,14 +4203,14 @@ 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 - options->flags.DIFF_FROM_CONTENTS = 1;
4206 + options->flags.diff_from_contents = 1;
4207 else
4208 - options->flags.DIFF_FROM_CONTENTS = 0;
4208 + options->flags.diff_from_contents = 0;
4209
4210 - if (options->flags.FIND_COPIES_HARDER)
4210 + if (options->flags.find_copies_harder)
4211 options->detect_rename = DIFF_DETECT_COPY;
4212
4213 - if (!options->flags.RELATIVE_NAME)
4213 + if (!options->flags.relative_name)
4214 options->prefix = NULL;
4215 if (options->prefix)
4216 options->prefix_length = strlen(options->prefix);
@@ -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 - options->flags.RECURSIVE = 1;
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 - options->flags.RECURSIVE = 1;
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 - options->flags.DIRTY_SUBMODULES = 1;
4254 + options->flags.dirty_submodules = 1;
4255
4256 if (options->detect_rename && options->rename_limit < 0)
4257 options->rename_limit = diff_rename_limit_default;
@@ -4273,14 +4273,14 @@ void diff_setup_done(struct diff_options *options)
4273 * to have found. It does not make sense not to return with
4274 * exit code in such a case either.
4275 */
4276 - if (options->flags.QUICK) {
4276 + if (options->flags.quick) {
4277 options->output_format = DIFF_FORMAT_NO_OUTPUT;
4278 - options->flags.EXIT_WITH_STATUS = 1;
4278 + options->flags.exit_with_status = 1;
4279 }
4280
4281 options->diff_path_counter = 0;
4282
4283 - if (options->flags.FOLLOW_RENAMES && options->pathspec.nr != 1)
4283 + if (options->flags.follow_renames && options->pathspec.nr != 1)
4284 die(_("--follow requires exactly one pathspec"));
4285
4286 if (!options->use_color || external_diff())
@@ -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 - options->flags.FIND_COPIES_HARDER = 1;
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 - options->flags.RENAME_EMPTY = 1;
4641 + options->flags.rename_empty = 1;
4642 else if (!strcmp(arg, "--no-rename-empty"))
4643 - options->flags.RENAME_EMPTY = 0;
4643 + options->flags.rename_empty = 0;
4644 else if (!strcmp(arg, "--relative"))
4645 - options->flags.RELATIVE_NAME = 1;
4645 + options->flags.relative_name = 1;
4646 else if (skip_prefix(arg, "--relative=", &arg)) {
4647 - options->flags.RELATIVE_NAME = 1;
4647 + options->flags.relative_name = 1;
4648 options->prefix = arg;
4649 }
4650
@@ -4684,21 +4684,21 @@ 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 - options->flags.BINARY = 1;
4687 + options->flags.binary = 1;
4688 }
4689 else if (!strcmp(arg, "--full-index"))
4690 - options->flags.FULL_INDEX = 1;
4690 + options->flags.full_index = 1;
4691 else if (!strcmp(arg, "-a") || !strcmp(arg, "--text"))
4692 - options->flags.TEXT = 1;
4692 + options->flags.text = 1;
4693 else if (!strcmp(arg, "-R"))
4694 - options->flags.REVERSE_DIFF = 1;
4694 + options->flags.reverse_diff = 1;
4695 else if (!strcmp(arg, "--find-copies-harder"))
4696 - options->flags.FIND_COPIES_HARDER = 1;
4696 + options->flags.find_copies_harder = 1;
4697 else if (!strcmp(arg, "--follow"))
4698 - options->flags.FOLLOW_RENAMES = 1;
4698 + options->flags.follow_renames = 1;
4699 else if (!strcmp(arg, "--no-follow")) {
4700 - options->flags.FOLLOW_RENAMES = 0;
4701 - options->flags.DEFAULT_FOLLOW_RENAMES = 0;
4700 + options->flags.follow_renames = 0;
4701 + options->flags.default_follow_renames = 0;
4702 } else if (!strcmp(arg, "--color"))
4703 options->use_color = 1;
4704 else if (skip_prefix(arg, "--color=", &arg)) {
@@ -4755,23 +4755,23 @@ int diff_opt_parse(struct diff_options *options,
4755 return argcount;
4756 }
4757 else if (!strcmp(arg, "--exit-code"))
4758 - options->flags.EXIT_WITH_STATUS = 1;
4758 + options->flags.exit_with_status = 1;
4759 else if (!strcmp(arg, "--quiet"))
4760 - options->flags.QUICK = 1;
4760 + options->flags.quick = 1;
4761 else if (!strcmp(arg, "--ext-diff"))
4762 - options->flags.ALLOW_EXTERNAL = 1;
4762 + options->flags.allow_external = 1;
4763 else if (!strcmp(arg, "--no-ext-diff"))
4764 - options->flags.ALLOW_EXTERNAL = 0;
4764 + options->flags.allow_external = 0;
4765 else if (!strcmp(arg, "--textconv")) {
4766 - options->flags.ALLOW_TEXTCONV = 1;
4767 - options->flags.TEXTCONV_SET_VIA_CMDLINE = 1;
4766 + options->flags.allow_textconv = 1;
4767 + options->flags.textconv_set_via_cmdline = 1;
4768 } else if (!strcmp(arg, "--no-textconv"))
4769 - options->flags.ALLOW_TEXTCONV = 0;
4769 + options->flags.allow_textconv = 0;
4770 else if (!strcmp(arg, "--ignore-submodules")) {
4771 - options->flags.OVERRIDE_SUBMODULE_CONFIG = 1;
4771 + options->flags.override_submodule_config = 1;
4772 handle_ignore_submodules_arg(options, "all");
4773 } else if (skip_prefix(arg, "--ignore-submodules=", &arg)) {
4774 - options->flags.OVERRIDE_SUBMODULE_CONFIG = 1;
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,11 +4846,11 @@ int diff_opt_parse(struct diff_options *options,
4846 &options->interhunkcontext))
4847 ;
4848 else if (!strcmp(arg, "-W"))
4849 - options->flags.FUNCCONTEXT = 1;
4849 + options->flags.funccontext = 1;
4850 else if (!strcmp(arg, "--function-context"))
4851 - options->flags.FUNCCONTEXT = 1;
4851 + options->flags.funccontext = 1;
4852 else if (!strcmp(arg, "--no-function-context"))
4853 - options->flags.FUNCCONTEXT = 0;
4853 + options->flags.funccontext = 0;
4854 else if ((argcount = parse_long_opt("output", av, &optarg))) {
4855 char *path = prefix_filename(prefix, optarg);
4856 options->file = xfopen(path, "w");
@@ -5600,7 +5600,7 @@ void diff_flush(struct diff_options *options)
5600 separator++;
5601 }
5602
5603 - if (output_format & DIFF_FORMAT_DIRSTAT && options->flags.DIRSTAT_BY_LINE)
5603 + if (output_format & DIFF_FORMAT_DIRSTAT && options->flags.dirstat_by_line)
5604 dirstat_by_line = 1;
5605
5606 if (output_format & (DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT|DIFF_FORMAT_NUMSTAT) ||
@@ -5635,8 +5635,8 @@ void diff_flush(struct diff_options *options)
5635 }
5636
5637 if (output_format & DIFF_FORMAT_NO_OUTPUT &&
5638 - options->flags.EXIT_WITH_STATUS &&
5639 - options->flags.DIFF_FROM_CONTENTS) {
5638 + options->flags.exit_with_status &&
5639 + options->flags.diff_from_contents) {
5640 /*
5641 * run diff_flush_patch for the exit status. setting
5642 * options->file to /dev/null should be safe, because we
@@ -5684,11 +5684,11 @@ free_queue:
5684 * diff_addremove/diff_change does not set the bit when
5685 * DIFF_FROM_CONTENTS is in effect (e.g. with -w).
5686 */
5687 - if (options->flags.DIFF_FROM_CONTENTS) {
5687 + if (options->flags.diff_from_contents) {
5688 if (options->found_changes)
5689 - options->flags.HAS_CHANGES = 1;
5689 + options->flags.has_changes = 1;
5690 else
5691 - options->flags.HAS_CHANGES = 0;
5691 + options->flags.has_changes = 0;
5692 }
5693 }
5694
@@ -5808,7 +5808,7 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
5808 * to determine how many paths were dirty only
5809 * due to stat info mismatch.
5810 */
5811 - if (!diffopt->flags.NO_INDEX)
5811 + if (!diffopt->flags.no_index)
5812 diffopt->skip_stat_unmatch++;
5813 diff_free_filepair(p);
5814 }
@@ -5857,10 +5857,10 @@ void diffcore_std(struct diff_options *options)
5857 diff_resolve_rename_copy();
5858 diffcore_apply_filter(options);
5859
5860 - if (diff_queued_diff.nr && !options->flags.DIFF_FROM_CONTENTS)
5861 - options->flags.HAS_CHANGES = 1;
5860 + if (diff_queued_diff.nr && !options->flags.diff_from_contents)
5861 + options->flags.has_changes = 1;
5862 else
5863 - options->flags.HAS_CHANGES = 0;
5863 + options->flags.has_changes = 0;
5864
5865 options->found_follow = 0;
5866 }
@@ -5872,23 +5872,23 @@ int diff_result_code(struct diff_options *opt, int status)
5872 diff_warn_rename_limit("diff.renameLimit",
5873 opt->needed_rename_limit,
5874 opt->degraded_cc_to_c);
5875 - if (!opt->flags.EXIT_WITH_STATUS &&
5875 + if (!opt->flags.exit_with_status &&
5876 !(opt->output_format & DIFF_FORMAT_CHECKDIFF))
5877 return status;
5878 - if (opt->flags.EXIT_WITH_STATUS &&
5879 - opt->flags.HAS_CHANGES)
5878 + if (opt->flags.exit_with_status &&
5879 + opt->flags.has_changes)
5880 result |= 01;
5881 if ((opt->output_format & DIFF_FORMAT_CHECKDIFF) &&
5882 - opt->flags.CHECK_FAILED)
5882 + opt->flags.check_failed)
5883 result |= 02;
5884 return result;
5885 }
5886
5887 int diff_can_quit_early(struct diff_options *opt)
5888 {
5889 - return (opt->flags.QUICK &&
5889 + return (opt->flags.quick &&
5890 !opt->filter &&
5891 - opt->flags.HAS_CHANGES);
5891 + opt->flags.has_changes);
5892 }
5893
5894 /*
@@ -5901,9 +5901,9 @@ static int is_submodule_ignored(const char *path, struct diff_options *options)
5901 {
5902 int ignored = 0;
5903 struct diff_flags orig_flags = options->flags;
5904 - if (!options->flags.OVERRIDE_SUBMODULE_CONFIG)
5904 + if (!options->flags.override_submodule_config)
5905 set_diffopt_flags_from_submodule_config(options, path);
5906 - if (options->flags.IGNORE_SUBMODULES)
5906 + if (options->flags.ignore_submodules)
5907 ignored = 1;
5908 options->flags = orig_flags;
5909 return ignored;
@@ -5932,7 +5932,7 @@ void diff_addremove(struct diff_options *options,
5932 * Before the final output happens, they are pruned after
5933 * merged into rename/copy pairs as appropriate.
5934 */
5935 - if (options->flags.REVERSE_DIFF)
5935 + if (options->flags.reverse_diff)
5936 addremove = (addremove == '+' ? '-' :
5937 addremove == '-' ? '+' : addremove);
5938
@@ -5951,8 +5951,8 @@ void diff_addremove(struct diff_options *options,
5951 }
5952
5953 diff_queue(&diff_queued_diff, one, two);
5954 - if (!options->flags.DIFF_FROM_CONTENTS)
5955 - options->flags.HAS_CHANGES = 1;
5954 + if (!options->flags.diff_from_contents)
5955 + options->flags.has_changes = 1;
5956 }
5957
5958 void diff_change(struct diff_options *options,
@@ -5970,7 +5970,7 @@ void diff_change(struct diff_options *options,
5970 is_submodule_ignored(concatpath, options))
5971 return;
5972
5973 - if (options->flags.REVERSE_DIFF) {
5973 + if (options->flags.reverse_diff) {
5974 SWAP(old_mode, new_mode);
5975 SWAP(old_oid, new_oid);
5976 SWAP(old_oid_valid, new_oid_valid);
@@ -5989,14 +5989,14 @@ void diff_change(struct diff_options *options,
5989 two->dirty_submodule = new_dirty_submodule;
5990 p = diff_queue(&diff_queued_diff, one, two);
5991
5992 - if (options->flags.DIFF_FROM_CONTENTS)
5992 + if (options->flags.diff_from_contents)
5993 return;
5994
5995 - if (options->flags.QUICK && options->skip_stat_unmatch &&
5995 + if (options->flags.quick && options->skip_stat_unmatch &&
5996 !diff_filespec_check_stat_unmatch(p))
5997 return;
5998
5999 - options->flags.HAS_CHANGES = 1;
5999 + options->flags.has_changes = 1;
6000 }
6001
6002 struct diff_filepair *diff_unmerge(struct diff_options *options, const char *path)
@@ -6134,7 +6134,7 @@ void setup_diff_pager(struct diff_options *opt)
6134 * and because it is easy to find people oneline advising "git diff
6135 * --exit-code" in hooks and other scripts, we do not do so.
6136 */
6137 - if (!opt->flags.EXIT_WITH_STATUS &&
6137 + if (!opt->flags.exit_with_status &&
6138 check_pager_config("diff") != 0)
6139 setup_pager();
6140 }
diff.h
+31 -31
@@ -62,37 +62,37 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)
62
63 #define DIFF_FLAGS_INIT { 0 }
64 struct diff_flags {
65 - unsigned RECURSIVE:1;
66 - unsigned TREE_IN_RECURSIVE:1;
67 - unsigned BINARY:1;
68 - unsigned TEXT:1;
69 - unsigned FULL_INDEX:1;
70 - unsigned SILENT_ON_REMOVE:1;
71 - unsigned FIND_COPIES_HARDER:1;
72 - unsigned FOLLOW_RENAMES:1;
73 - unsigned RENAME_EMPTY:1;
74 - unsigned HAS_CHANGES:1;
75 - unsigned QUICK:1;
76 - unsigned NO_INDEX:1;
77 - unsigned ALLOW_EXTERNAL:1;
78 - unsigned EXIT_WITH_STATUS:1;
79 - unsigned REVERSE_DIFF:1;
80 - unsigned CHECK_FAILED:1;
81 - unsigned RELATIVE_NAME:1;
82 - unsigned IGNORE_SUBMODULES:1;
83 - unsigned DIRSTAT_CUMULATIVE:1;
84 - unsigned DIRSTAT_BY_FILE:1;
85 - unsigned ALLOW_TEXTCONV:1;
86 - unsigned TEXTCONV_SET_VIA_CMDLINE:1;
87 - unsigned DIFF_FROM_CONTENTS:1;
88 - unsigned DIRTY_SUBMODULES:1;
89 - unsigned IGNORE_UNTRACKED_IN_SUBMODULES:1;
90 - unsigned IGNORE_DIRTY_SUBMODULES:1;
91 - unsigned OVERRIDE_SUBMODULE_CONFIG:1;
92 - unsigned DIRSTAT_BY_LINE:1;
93 - unsigned FUNCCONTEXT:1;
94 - unsigned PICKAXE_IGNORE_CASE:1;
95 - unsigned DEFAULT_FOLLOW_RENAMES:1;
65 + unsigned recursive:1;
66 + unsigned tree_in_recursive:1;
67 + unsigned binary:1;
68 + unsigned text:1;
69 + unsigned full_index:1;
70 + unsigned silent_on_remove:1;
71 + unsigned find_copies_harder:1;
72 + unsigned follow_renames:1;
73 + unsigned rename_empty:1;
74 + unsigned has_changes:1;
75 + unsigned quick:1;
76 + unsigned no_index:1;
77 + unsigned allow_external:1;
78 + unsigned exit_with_status:1;
79 + unsigned reverse_diff:1;
80 + unsigned check_failed:1;
81 + unsigned relative_name:1;
82 + unsigned ignore_submodules:1;
83 + unsigned dirstat_cumulative:1;
84 + unsigned dirstat_by_file:1;
85 + unsigned allow_textconv:1;
86 + unsigned textconv_set_via_cmdline:1;
87 + unsigned diff_from_contents:1;
88 + unsigned dirty_submodules:1;
89 + unsigned ignore_untracked_in_submodules:1;
90 + unsigned ignore_dirty_submodules:1;
91 + unsigned override_submodule_config:1;
92 + unsigned dirstat_by_line:1;
93 + unsigned funccontext:1;
94 + unsigned pickaxe_ignore_case:1;
95 + unsigned default_follow_renames:1;
96 };
97
98 static inline void diff_flags_or(struct diff_flags *a,
diffcore-pickaxe.c
+4 -4
@@ -131,7 +131,7 @@ static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
131 if (!DIFF_FILE_VALID(p->one) && !DIFF_FILE_VALID(p->two))
132 return 0;
133
134 - if (o->flags.ALLOW_TEXTCONV) {
134 + if (o->flags.allow_textconv) {
135 textconv_one = get_textconv(p->one);
136 textconv_two = get_textconv(p->two);
137 }
@@ -222,11 +222,11 @@ void diffcore_pickaxe(struct diff_options *o)
222
223 if (opts & (DIFF_PICKAXE_REGEX | DIFF_PICKAXE_KIND_G)) {
224 int cflags = REG_EXTENDED | REG_NEWLINE;
225 - if (o->flags.PICKAXE_IGNORE_CASE)
225 + if (o->flags.pickaxe_ignore_case)
226 cflags |= REG_ICASE;
227 regcomp_or_die(&regex, needle, cflags);
228 regexp = &regex;
229 - } else if (o->flags.PICKAXE_IGNORE_CASE &&
229 + } else if (o->flags.pickaxe_ignore_case &&
230 has_non_ascii(needle)) {
231 struct strbuf sb = STRBUF_INIT;
232 int cflags = REG_NEWLINE | REG_ICASE;
@@ -236,7 +236,7 @@ void diffcore_pickaxe(struct diff_options *o)
236 strbuf_release(&sb);
237 regexp = &regex;
238 } else {
239 - kws = kwsalloc(o->flags.PICKAXE_IGNORE_CASE
239 + kws = kwsalloc(o->flags.pickaxe_ignore_case
240 ? tolower_trans_tbl : NULL);
241 kwsincr(kws, needle, strlen(needle));
242 kwsprep(kws);
diffcore-rename.c
+3 -3
@@ -405,7 +405,7 @@ static int too_many_rename_candidates(int num_create,
405 num_src > num_create ? num_src : num_create;
406
407 /* Are we running under -C -C? */
408 - if (!options->flags.FIND_COPIES_HARDER)
408 + if (!options->flags.find_copies_harder)
409 return 1;
410
411 /* Would we bust the limit if we were running under -C? */
@@ -463,7 +463,7 @@ void diffcore_rename(struct diff_options *options)
463 else if (options->single_follow &&
464 strcmp(options->single_follow, p->two->path))
465 continue; /* not interested */
466 - else if (!options->flags.RENAME_EMPTY &&
466 + else if (!options->flags.rename_empty &&
467 is_empty_blob_oid(&p->two->oid))
468 continue;
469 else if (add_rename_dst(p->two) < 0) {
@@ -473,7 +473,7 @@ void diffcore_rename(struct diff_options *options)
473 goto cleanup;
474 }
475 }
476 - else if (!options->flags.RENAME_EMPTY &&
476 + else if (!options->flags.rename_empty &&
477 is_empty_blob_oid(&p->one->oid))
478 continue;
479 else if (!DIFF_PAIR_UNMERGED(p) && !DIFF_FILE_VALID(p->two)) {
log-tree.c
+1 -1
@@ -793,7 +793,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
793 struct commit_list *parents;
794 struct object_id *oid;
795
796 - if (!opt->diff && !opt->diffopt.flags.EXIT_WITH_STATUS)
796 + if (!opt->diff && !opt->diffopt.flags.exit_with_status)
797 return 0;
798
799 parse_commit_or_die(commit);
merge-recursive.c
+2 -2
@@ -540,8 +540,8 @@ static struct string_list *get_renames(struct merge_options *o,
540 return renames;
541
542 diff_setup(&opts);
543 - opts.flags.RECURSIVE = 1;
544 - opts.flags.RENAME_EMPTY = 0;
543 + opts.flags.recursive = 1;
544 + opts.flags.rename_empty = 0;
545 opts.detect_rename = DIFF_DETECT_RENAME;
546 opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
547 o->diff_rename_limit >= 0 ? o->diff_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 - opt.flags.RECURSIVE = 1;
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 - opt.flags.RECURSIVE = 1;
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 - ids->diffopts.flags.RECURSIVE = 1;
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
+12 -12
@@ -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 - options->flags.HAS_CHANGES = 1;
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 - options->flags.HAS_CHANGES = 1;
425 + options->flags.has_changes = 1;
426 }
427
428 static int rev_compare_tree(struct rev_info *revs,
@@ -455,7 +455,7 @@ static int rev_compare_tree(struct rev_info *revs,
455 }
456
457 tree_difference = REV_TREE_SAME;
458 - revs->pruning.flags.HAS_CHANGES = 0;
458 + revs->pruning.flags.has_changes = 0;
459 if (diff_tree_oid(&t1->object.oid, &t2->object.oid, "",
460 &revs->pruning) < 0)
461 return REV_TREE_DIFFERENT;
@@ -471,7 +471,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
471 return 0;
472
473 tree_difference = REV_TREE_SAME;
474 - revs->pruning.flags.HAS_CHANGES = 0;
474 + revs->pruning.flags.has_changes = 0;
475 retval = diff_tree_oid(NULL, &t1->object.oid, "", &revs->pruning);
476
477 return retval >= 0 && (tree_difference == REV_TREE_SAME);
@@ -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 - revs->pruning.flags.RECURSIVE = 1;
1407 - revs->pruning.flags.QUICK = 1;
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 - revs->diffopt.flags.RECURSIVE = 1;
1920 + revs->diffopt.flags.recursive = 1;
1921 } else if (!strcmp(arg, "-t")) {
1922 revs->diff = 1;
1923 - revs->diffopt.flags.RECURSIVE = 1;
1924 - revs->diffopt.flags.TREE_IN_RECURSIVE = 1;
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 - revs->diffopt.flags.PICKAXE_IGNORE_CASE = 1;
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")) {
@@ -2399,7 +2399,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
2399 /* Pickaxe, diff-filter and rename following need diffs */
2400 if (revs->diffopt.pickaxe ||
2401 revs->diffopt.filter ||
2402 - revs->diffopt.flags.FOLLOW_RENAMES)
2402 + revs->diffopt.flags.follow_renames)
2403 revs->diff = 1;
2404
2405 if (revs->topo_order)
@@ -2408,7 +2408,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
2408 if (revs->prune_data.nr) {
2409 copy_pathspec(&revs->pruning.pathspec, &revs->prune_data);
2410 /* Can't prune commits with rename following: the paths change.. */
2411 - if (!revs->diffopt.flags.FOLLOW_RENAMES)
2411 + if (!revs->diffopt.flags.follow_renames)
2412 revs->prune = 1;
2413 if (!revs->full_diff)
2414 copy_pathspec(&revs->diffopt.pathspec,
submodule.c
+8 -8
@@ -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 - diffopt->flags.IGNORE_SUBMODULES = 1;
186 + diffopt->flags.ignore_submodules = 1;
187 }
188 }
189
@@ -402,16 +402,16 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy
402 void handle_ignore_submodules_arg(struct diff_options *diffopt,
403 const char *arg)
404 {
405 - diffopt->flags.IGNORE_SUBMODULES = 0;
406 - diffopt->flags.IGNORE_UNTRACKED_IN_SUBMODULES = 0;
407 - diffopt->flags.IGNORE_DIRTY_SUBMODULES = 0;
405 + diffopt->flags.ignore_submodules = 0;
406 + diffopt->flags.ignore_untracked_in_submodules = 0;
407 + diffopt->flags.ignore_dirty_submodules = 0;
408
409 if (!strcmp(arg, "all"))
410 - diffopt->flags.IGNORE_SUBMODULES = 1;
410 + diffopt->flags.ignore_submodules = 1;
411 else if (!strcmp(arg, "untracked"))
412 - diffopt->flags.IGNORE_UNTRACKED_IN_SUBMODULES = 1;
412 + diffopt->flags.ignore_untracked_in_submodules = 1;
413 else if (!strcmp(arg, "dirty"))
414 - diffopt->flags.IGNORE_DIRTY_SUBMODULES = 1;
414 + diffopt->flags.ignore_dirty_submodules = 1;
415 else if (strcmp(arg, "none"))
416 die("bad --ignore-submodules argument: %s", arg);
417 }
@@ -616,7 +616,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
616 argv_array_pushf(&cp.args, "--color=%s", want_color(o->use_color) ?
617 "always" : "never");
618
619 - if (o->flags.REVERSE_DIFF) {
619 + if (o->flags.reverse_diff) {
620 argv_array_pushf(&cp.args, "--src-prefix=%s%s/",
621 o->b_prefix, path);
622 argv_array_pushf(&cp.args, "--dst-prefix=%s%s/",
tree-diff.c
+8 -8
@@ -212,9 +212,9 @@ static struct combine_diff_path *emit_path(struct combine_diff_path *p,
212 mode = 0;
213 }
214
215 - if (opt->flags.RECURSIVE && isdir) {
215 + if (opt->flags.recursive && isdir) {
216 recurse = 1;
217 - emitthis = opt->flags.TREE_IN_RECURSIVE;
217 + emitthis = opt->flags.tree_in_recursive;
218 }
219
220 if (emitthis) {
@@ -425,7 +425,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
425 ttree = fill_tree_descriptor(&t, oid);
426
427 /* Enable recursion indefinitely */
428 - opt->pathspec.recursive = opt->flags.RECURSIVE;
428 + opt->pathspec.recursive = opt->flags.recursive;
429
430 for (;;) {
431 int imin, cmp;
@@ -484,7 +484,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
484 /* t = p[imin] */
485 if (cmp == 0) {
486 /* are either pi > p[imin] or diff(t,pi) != ø ? */
487 - if (!opt->flags.FIND_COPIES_HARDER) {
487 + if (!opt->flags.find_copies_harder) {
488 for (i = 0; i < nparent; ++i) {
489 /* p[i] > p[imin] */
490 if (tp[i].entry.mode & S_IFXMIN_NEQ)
@@ -522,7 +522,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
522 /* t > p[imin] */
523 else {
524 /* ∀i pi=p[imin] -> D += "-p[imin]" */
525 - if (!opt->flags.FIND_COPIES_HARDER) {
525 + if (!opt->flags.find_copies_harder) {
526 for (i = 0; i < nparent; ++i)
527 if (tp[i].entry.mode & S_IFXMIN_NEQ)
528 goto skip_emit_tp;
@@ -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_opts.flags.RECURSIVE = 1;
612 - diff_opts.flags.FIND_COPIES_HARDER = 1;
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;
@@ -706,7 +706,7 @@ int diff_tree_oid(const struct object_id *old_oid,
706 strbuf_addstr(&base, base_str);
707
708 retval = ll_diff_tree_oid(old_oid, new_oid, &base, opt);
709 - if (!*base_str && opt->flags.FOLLOW_RENAMES && diff_might_be_rename())
709 + if (!*base_str && opt->flags.follow_renames && diff_might_be_rename())
710 try_to_follow_renames(old_oid, new_oid, &base, opt);
711
712 strbuf_release(&base);
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 - rev.diffopt.flags.DIRTY_SUBMODULES = 1;
562 + rev.diffopt.flags.dirty_submodules = 1;
563 rev.diffopt.ita_invisible_in_index = 1;
564 if (!s->show_untracked_files)
565 - rev.diffopt.flags.IGNORE_UNTRACKED_IN_SUBMODULES = 1;
565 + rev.diffopt.flags.ignore_untracked_in_submodules = 1;
566 if (s->ignore_submodule_arg) {
567 - rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
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 - rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
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 - rev.diffopt.flags.ALLOW_TEXTCONV = 1;
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 - rev_info.diffopt.flags.IGNORE_SUBMODULES = 1;
2267 - rev_info.diffopt.flags.QUICK = 1;
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 - rev_info.diffopt.flags.IGNORE_SUBMODULES = 1;
2287 - rev_info.diffopt.flags.QUICK = 1;
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);