diff options
author | Brandon Williams <bmwill@google.com> | 2017-10-31 19:19:08 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-01 03:50:03 +0100 |
commit | 3b69daed861daec1923c369d59c97e46eb3c3d7b (patch) | |
tree | bc66d274c0b97aa27526320778387e557dc22dbe /builtin | |
parent | diff: remove touched flags (diff) | |
download | git-3b69daed861daec1923c369d59c97e46eb3c3d7b.tar.xz git-3b69daed861daec1923c369d59c97e46eb3c3d7b.zip |
diff: remove DIFF_OPT_TST macro
Remove the `DIFF_OPT_TST` macro and instead access the flags directly.
This conversion is done using the following semantic patch:
@@
expression E;
identifier fld;
@@
- DIFF_OPT_TST(&E, fld)
+ E.flags.fld
@@
type T;
T *ptr;
identifier fld;
@@
- DIFF_OPT_TST(ptr, fld)
+ ptr->flags.fld
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/am.c | 2 | ||||
-rw-r--r-- | builtin/blame.c | 4 | ||||
-rw-r--r-- | builtin/diff.c | 2 | ||||
-rw-r--r-- | builtin/log.c | 12 | ||||
-rw-r--r-- | builtin/rev-list.c | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/builtin/am.c b/builtin/am.c index d7513f5375..fc54724cc1 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1168,7 +1168,7 @@ static int index_has_changes(struct strbuf *sb) strbuf_addstr(sb, diff_queued_diff.queue[i]->two->path); } diff_flush(&opt); - return DIFF_OPT_TST(&opt, HAS_CHANGES) != 0; + return opt.flags.HAS_CHANGES != 0; } else { for (i = 0; sb && i < active_nr; i++) { if (i) diff --git a/builtin/blame.c b/builtin/blame.c index 67adaef4d8..a295749844 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -734,7 +734,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) parse_revision_opt(&revs, &ctx, options, blame_opt_usage); } parse_done: - no_whole_file_rename = !DIFF_OPT_TST(&revs.diffopt, FOLLOW_RENAMES); + no_whole_file_rename = !revs.diffopt.flags.FOLLOW_RENAMES; xdl_opts |= revs.diffopt.xdl_opts & XDF_INDENT_HEURISTIC; DIFF_OPT_CLR(&revs.diffopt, FOLLOW_RENAMES); argc = parse_options_end(&ctx); @@ -803,7 +803,7 @@ parse_done: } blame_date_width -= 1; /* strip the null */ - if (DIFF_OPT_TST(&revs.diffopt, FIND_COPIES_HARDER)) + if (revs.diffopt.flags.FIND_COPIES_HARDER) opt |= (PICKAXE_BLAME_COPY | PICKAXE_BLAME_MOVE | PICKAXE_BLAME_COPY_HARDER); diff --git a/builtin/diff.c b/builtin/diff.c index f5bbd4d757..8cbaf45384 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -44,7 +44,7 @@ static void stuff_change(struct diff_options *opt, !oidcmp(old_oid, new_oid) && (old_mode == new_mode)) return; - if (DIFF_OPT_TST(opt, REVERSE_DIFF)) { + if (opt->flags.REVERSE_DIFF) { SWAP(old_mode, new_mode); SWAP(old_oid, new_oid); SWAP(old_path, new_path); diff --git a/builtin/log.c b/builtin/log.c index 9c08152700..2b2d366780 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -181,7 +181,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, init_display_notes(&rev->notes_opt); if (rev->diffopt.pickaxe || rev->diffopt.filter || - DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) + rev->diffopt.flags.FOLLOW_RENAMES) rev->always_show_header = 0; if (source) @@ -391,7 +391,7 @@ static int cmd_log_walk(struct rev_info *rev) fclose(rev->diffopt.file); if (rev->diffopt.output_format & DIFF_FORMAT_CHECKDIFF && - DIFF_OPT_TST(&rev->diffopt, CHECK_FAILED)) { + rev->diffopt.flags.CHECK_FAILED) { return 02; } 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 unsigned long size; fflush(rev->diffopt.file); - if (!DIFF_OPT_TST(&rev->diffopt, TEXTCONV_SET_VIA_CMDLINE) || - !DIFF_OPT_TST(&rev->diffopt, ALLOW_TEXTCONV)) + if (!rev->diffopt.flags.TEXTCONV_SET_VIA_CMDLINE || + !rev->diffopt.flags.ALLOW_TEXTCONV) return stream_blob_to_fd(1, oid, NULL, 0); if (get_oid_with_context(obj_name, GET_OID_RECORD_PATH, @@ -666,7 +666,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix) static void log_setup_revisions_tweak(struct rev_info *rev, struct setup_revision_opt *opt) { - if (DIFF_OPT_TST(&rev->diffopt, DEFAULT_FOLLOW_RENAMES) && + if (rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES && rev->prune_data.nr == 1) DIFF_OPT_SET(&rev->diffopt, FOLLOW_RENAMES); @@ -1612,7 +1612,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) rev.zero_commit = zero_commit; - if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff) + if (!rev.diffopt.flags.TEXT && !no_binary_diff) DIFF_OPT_SET(&rev.diffopt, BINARY); if (rev.show_notes) diff --git a/builtin/rev-list.c b/builtin/rev-list.c index c1c74d4a79..c62382171b 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -294,7 +294,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) if (revs.bisect) bisect_list = 1; - if (DIFF_OPT_TST(&revs.diffopt, QUICK)) + if (revs.diffopt.flags.QUICK) info.flags |= REV_LIST_QUIET; for (i = 1 ; i < argc; i++) { const char *arg = argv[i]; |