summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-10-31 18:19:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-01 02:50:03 (GMT)
commit23dcf77f48feb49c54bad09210f093a799816334 (patch)
treeeff748e83bc0e1bf41b631d77d5c38f82a549ee5 /builtin
parent3b69daed861daec1923c369d59c97e46eb3c3d7b (diff)
downloadgit-23dcf77f48feb49c54bad09210f093a799816334.zip
git-23dcf77f48feb49c54bad09210f093a799816334.tar.gz
git-23dcf77f48feb49c54bad09210f093a799816334.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/add.c4
-rw-r--r--builtin/am.c8
-rw-r--r--builtin/blame.c4
-rw-r--r--builtin/diff.c6
-rw-r--r--builtin/fast-export.c2
-rw-r--r--builtin/log.c14
-rw-r--r--builtin/reset.c2
7 files changed, 20 insertions, 20 deletions
diff --git a/builtin/add.c b/builtin/add.c
index b70e8a7..e1d83b6 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -116,7 +116,7 @@ int add_files_to_cache(const char *prefix,
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = update_callback;
rev.diffopt.format_callback_data = &data;
- DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
+ rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
rev.max_count = 0; /* do not compare unmerged paths with stage #2 */
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
clear_pathspec(&rev.prune_data);
@@ -218,7 +218,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
argc = setup_revisions(argc, argv, &rev, NULL);
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
rev.diffopt.use_color = 0;
- DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
+ rev.diffopt.flags.IGNORE_DIRTY_SUBMODULES = 1;
out = open(file, O_CREAT | O_WRONLY, 0666);
if (out < 0)
die(_("Could not open '%s' for writing."), file);
diff --git a/builtin/am.c b/builtin/am.c
index fc54724..015425a 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1157,9 +1157,9 @@ static int index_has_changes(struct strbuf *sb)
struct diff_options opt;
diff_setup(&opt);
- DIFF_OPT_SET(&opt, EXIT_WITH_STATUS);
+ opt.flags.EXIT_WITH_STATUS = 1;
if (!sb)
- DIFF_OPT_SET(&opt, QUICK);
+ opt.flags.QUICK = 1;
do_diff_cache(&head, &opt);
diffcore_std(&opt);
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
rev_info.show_root_diff = 1;
rev_info.diffopt.output_format = DIFF_FORMAT_PATCH;
rev_info.no_commit_id = 1;
- DIFF_OPT_SET(&rev_info.diffopt, BINARY);
- DIFF_OPT_SET(&rev_info.diffopt, FULL_INDEX);
+ rev_info.diffopt.flags.BINARY = 1;
+ rev_info.diffopt.flags.FULL_INDEX = 1;
rev_info.diffopt.use_color = 0;
rev_info.diffopt.file = fp;
rev_info.diffopt.close_file = 1;
diff --git a/builtin/blame.c b/builtin/blame.c
index a295749..76994aa 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -708,8 +708,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
git_config(git_blame_config, &output_option);
init_revisions(&revs, NULL);
revs.date_mode = blame_date_mode;
- DIFF_OPT_SET(&revs.diffopt, ALLOW_TEXTCONV);
- DIFF_OPT_SET(&revs.diffopt, FOLLOW_RENAMES);
+ revs.diffopt.flags.ALLOW_TEXTCONV = 1;
+ revs.diffopt.flags.FOLLOW_RENAMES = 1;
save_commit_buffer = 0;
dashdash_pos = 0;
diff --git a/builtin/diff.c b/builtin/diff.c
index 8cbaf45..ed41eb5 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -350,8 +350,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
rev.diffopt.stat_graph_width = -1;
/* Default to let external and textconv be used */
- DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
- DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
+ rev.diffopt.flags.ALLOW_EXTERNAL = 1;
+ rev.diffopt.flags.ALLOW_TEXTCONV = 1;
if (nongit)
die(_("Not a git repository"));
@@ -361,7 +361,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
diff_setup_done(&rev.diffopt);
}
- DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
+ rev.diffopt.flags.RECURSIVE = 1;
setup_diff_pager(&rev.diffopt);
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 2fb60d6..35c8fb6 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -1066,7 +1066,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
die("revision walk setup failed");
revs.diffopt.format_callback = show_filemodify;
revs.diffopt.format_callback_data = &paths_of_changed_objects;
- DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
+ revs.diffopt.flags.RECURSIVE = 1;
while ((commit = get_revision(&revs))) {
if (has_unshown_parent(commit)) {
add_object_array(&commit->object, NULL, &commits);
diff --git a/builtin/log.c b/builtin/log.c
index 2b2d366..4a24d3e 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -121,16 +121,16 @@ static void cmd_log_init_defaults(struct rev_info *rev)
if (fmt_pretty)
get_commit_format(fmt_pretty, rev);
if (default_follow)
- DIFF_OPT_SET(&rev->diffopt, DEFAULT_FOLLOW_RENAMES);
+ rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES = 1;
rev->verbose_header = 1;
- DIFF_OPT_SET(&rev->diffopt, RECURSIVE);
+ rev->diffopt.flags.RECURSIVE = 1;
rev->diffopt.stat_width = -1; /* use full terminal width */
rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
rev->abbrev_commit = default_abbrev_commit;
rev->show_root_diff = default_show_root;
rev->subject_prefix = fmt_patch_subject_prefix;
rev->show_signature = default_show_signature;
- DIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);
+ rev->diffopt.flags.ALLOW_TEXTCONV = 1;
if (default_date_mode)
parse_date_format(default_date_mode, &rev->date_mode);
@@ -668,7 +668,7 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
{
if (rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES &&
rev->prune_data.nr == 1)
- DIFF_OPT_SET(&rev->diffopt, FOLLOW_RENAMES);
+ rev->diffopt.flags.FOLLOW_RENAMES = 1;
/* Turn --cc/-c into -p --cc/-c when -p was not given */
if (!rev->diffopt.output_format && rev->combine_merges)
@@ -1340,7 +1340,7 @@ static void prepare_bases(struct base_tree_info *bases,
return;
diff_setup(&diffopt);
- DIFF_OPT_SET(&diffopt, RECURSIVE);
+ diffopt.flags.RECURSIVE = 1;
diff_setup_done(&diffopt);
oidcpy(&bases->base_commit, &base->object.oid);
@@ -1511,7 +1511,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
rev.verbose_header = 1;
rev.diff = 1;
rev.max_parents = 1;
- DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
+ rev.diffopt.flags.RECURSIVE = 1;
rev.subject_prefix = fmt_patch_subject_prefix;
memset(&s_r_opt, 0, sizeof(s_r_opt));
s_r_opt.def = "HEAD";
@@ -1613,7 +1613,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
rev.zero_commit = zero_commit;
if (!rev.diffopt.flags.TEXT && !no_binary_diff)
- DIFF_OPT_SET(&rev.diffopt, BINARY);
+ rev.diffopt.flags.BINARY = 1;
if (rev.show_notes)
init_display_notes(&rev.notes_opt);
diff --git a/builtin/reset.c b/builtin/reset.c
index ea2fad5..206819e 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -166,7 +166,7 @@ static int read_from_tree(const struct pathspec *pathspec,
opt.output_format = DIFF_FORMAT_CALLBACK;
opt.format_callback = update_index_from_diff;
opt.format_callback_data = &intent_to_add;
- DIFF_OPT_SET(&opt, OVERRIDE_SUBMODULE_CONFIG);
+ opt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
if (do_diff_cache(tree_oid, &opt))
return 1;