From 3b69daed861daec1923c369d59c97e46eb3c3d7b Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 31 Oct 2017 11:19:08 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- combine-diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'combine-diff.c') diff --git a/combine-diff.c b/combine-diff.c index 9e163d5ada..40cb4dd1a5 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -898,7 +898,7 @@ static void show_combined_header(struct combine_diff_path *elem, int show_file_header) { struct diff_options *opt = &rev->diffopt; - int abbrev = DIFF_OPT_TST(opt, FULL_INDEX) ? GIT_SHA1_HEXSZ : DEFAULT_ABBREV; + int abbrev = opt->flags.FULL_INDEX ? GIT_SHA1_HEXSZ : DEFAULT_ABBREV; const char *a_prefix = opt->a_prefix ? opt->a_prefix : "a/"; const char *b_prefix = opt->b_prefix ? opt->b_prefix : "b/"; 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, userdiff = userdiff_find_by_path(elem->path); if (!userdiff) userdiff = userdiff_find_by_name("default"); - if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV)) + if (opt->flags.ALLOW_TEXTCONV) textconv = userdiff_get_textconv(userdiff); /* Read the result of merge first */ @@ -1435,7 +1435,7 @@ void diff_tree_combined(const struct object_id *oid, * NOTE please keep this semantically in sync with diffcore_std() */ need_generic_pathscan = opt->skip_stat_unmatch || - DIFF_OPT_TST(opt, FOLLOW_RENAMES) || + opt->flags.FOLLOW_RENAMES || opt->break_opt != -1 || opt->detect_rename || opt->pickaxe || -- cgit v1.2.3 From 23dcf77f48feb49c54bad09210f093a799816334 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 31 Oct 2017 11:19:09 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- combine-diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'combine-diff.c') diff --git a/combine-diff.c b/combine-diff.c index 40cb4dd1a5..204b0dfce4 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1413,7 +1413,7 @@ void diff_tree_combined(const struct object_id *oid, diffopts = *opt; copy_pathspec(&diffopts.pathspec, &opt->pathspec); - DIFF_OPT_SET(&diffopts, RECURSIVE); + diffopts.flags.RECURSIVE = 1; DIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL); /* find set of paths that everybody touches -- cgit v1.2.3 From b2100e529171f0bbd497366618436cf86c08a324 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 31 Oct 2017 11:19:10 -0700 Subject: diff: remove DIFF_OPT_CLR macro Remove the `DIFF_OPT_CLR` macro and instead set the flags directly. This conversion is done using the following semantic patch: @@ expression E; identifier fld; @@ - DIFF_OPT_CLR(&E, fld) + E.flags.fld = 0 @@ type T; T *ptr; identifier fld; @@ - DIFF_OPT_CLR(ptr, fld) + ptr->flags.fld = 0 Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- combine-diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'combine-diff.c') diff --git a/combine-diff.c b/combine-diff.c index 204b0dfce4..5a3a8b49be 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1414,7 +1414,7 @@ void diff_tree_combined(const struct object_id *oid, diffopts = *opt; copy_pathspec(&diffopts.pathspec, &opt->pathspec); diffopts.flags.RECURSIVE = 1; - DIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL); + diffopts.flags.ALLOW_EXTERNAL = 0; /* find set of paths that everybody touches * -- cgit v1.2.3 From 0d1e0e7801bb2ae22036ad09f9f5cec17e08c48b Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 31 Oct 2017 11:19:11 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- combine-diff.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'combine-diff.c') diff --git a/combine-diff.c b/combine-diff.c index 5a3a8b49be..23f3d25e2a 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -898,7 +898,7 @@ static void show_combined_header(struct combine_diff_path *elem, int show_file_header) { struct diff_options *opt = &rev->diffopt; - int abbrev = opt->flags.FULL_INDEX ? GIT_SHA1_HEXSZ : DEFAULT_ABBREV; + int abbrev = opt->flags.full_index ? GIT_SHA1_HEXSZ : DEFAULT_ABBREV; const char *a_prefix = opt->a_prefix ? opt->a_prefix : "a/"; const char *b_prefix = opt->b_prefix ? opt->b_prefix : "b/"; 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, userdiff = userdiff_find_by_path(elem->path); if (!userdiff) userdiff = userdiff_find_by_name("default"); - if (opt->flags.ALLOW_TEXTCONV) + if (opt->flags.allow_textconv) textconv = userdiff_get_textconv(userdiff); /* Read the result of merge first */ @@ -1413,8 +1413,8 @@ void diff_tree_combined(const struct object_id *oid, diffopts = *opt; copy_pathspec(&diffopts.pathspec, &opt->pathspec); - diffopts.flags.RECURSIVE = 1; - diffopts.flags.ALLOW_EXTERNAL = 0; + diffopts.flags.recursive = 1; + diffopts.flags.allow_external = 0; /* find set of paths that everybody touches * @@ -1435,7 +1435,7 @@ void diff_tree_combined(const struct object_id *oid, * NOTE please keep this semantically in sync with diffcore_std() */ need_generic_pathscan = opt->skip_stat_unmatch || - opt->flags.FOLLOW_RENAMES || + opt->flags.follow_renames || opt->break_opt != -1 || opt->detect_rename || opt->pickaxe || -- cgit v1.2.3