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>
This commit is contained in:
parent
3b69daed86
commit
23dcf77f48
8
blame.c
8
blame.c
@ -541,7 +541,7 @@ static struct blame_origin *find_origin(struct commit *parent,
|
|||||||
* same and diff-tree is fairly efficient about this.
|
* same and diff-tree is fairly efficient about this.
|
||||||
*/
|
*/
|
||||||
diff_setup(&diff_opts);
|
diff_setup(&diff_opts);
|
||||||
DIFF_OPT_SET(&diff_opts, RECURSIVE);
|
diff_opts.flags.RECURSIVE = 1;
|
||||||
diff_opts.detect_rename = 0;
|
diff_opts.detect_rename = 0;
|
||||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
paths[0] = origin->path;
|
paths[0] = origin->path;
|
||||||
@ -615,7 +615,7 @@ static struct blame_origin *find_rename(struct commit *parent,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
diff_setup(&diff_opts);
|
diff_setup(&diff_opts);
|
||||||
DIFF_OPT_SET(&diff_opts, RECURSIVE);
|
diff_opts.flags.RECURSIVE = 1;
|
||||||
diff_opts.detect_rename = DIFF_DETECT_RENAME;
|
diff_opts.detect_rename = DIFF_DETECT_RENAME;
|
||||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
diff_opts.single_follow = origin->path;
|
diff_opts.single_follow = origin->path;
|
||||||
@ -1238,7 +1238,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
|
|||||||
return; /* nothing remains for this target */
|
return; /* nothing remains for this target */
|
||||||
|
|
||||||
diff_setup(&diff_opts);
|
diff_setup(&diff_opts);
|
||||||
DIFF_OPT_SET(&diff_opts, RECURSIVE);
|
diff_opts.flags.RECURSIVE = 1;
|
||||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
|
|
||||||
diff_setup_done(&diff_opts);
|
diff_setup_done(&diff_opts);
|
||||||
@ -1253,7 +1253,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
|
|||||||
if ((opt & PICKAXE_BLAME_COPY_HARDEST)
|
if ((opt & PICKAXE_BLAME_COPY_HARDEST)
|
||||||
|| ((opt & PICKAXE_BLAME_COPY_HARDER)
|
|| ((opt & PICKAXE_BLAME_COPY_HARDER)
|
||||||
&& (!porigin || strcmp(target->path, porigin->path))))
|
&& (!porigin || strcmp(target->path, porigin->path))))
|
||||||
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
|
diff_opts.flags.FIND_COPIES_HARDER = 1;
|
||||||
|
|
||||||
if (is_null_oid(&target->commit->object.oid))
|
if (is_null_oid(&target->commit->object.oid))
|
||||||
do_diff_cache(&parent->tree->object.oid, &diff_opts);
|
do_diff_cache(&parent->tree->object.oid, &diff_opts);
|
||||||
|
@ -116,7 +116,7 @@ int add_files_to_cache(const char *prefix,
|
|||||||
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
|
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
|
||||||
rev.diffopt.format_callback = update_callback;
|
rev.diffopt.format_callback = update_callback;
|
||||||
rev.diffopt.format_callback_data = &data;
|
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 */
|
rev.max_count = 0; /* do not compare unmerged paths with stage #2 */
|
||||||
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
|
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
|
||||||
clear_pathspec(&rev.prune_data);
|
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);
|
argc = setup_revisions(argc, argv, &rev, NULL);
|
||||||
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
|
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
rev.diffopt.use_color = 0;
|
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);
|
out = open(file, O_CREAT | O_WRONLY, 0666);
|
||||||
if (out < 0)
|
if (out < 0)
|
||||||
die(_("Could not open '%s' for writing."), file);
|
die(_("Could not open '%s' for writing."), file);
|
||||||
|
@ -1157,9 +1157,9 @@ static int index_has_changes(struct strbuf *sb)
|
|||||||
struct diff_options opt;
|
struct diff_options opt;
|
||||||
|
|
||||||
diff_setup(&opt);
|
diff_setup(&opt);
|
||||||
DIFF_OPT_SET(&opt, EXIT_WITH_STATUS);
|
opt.flags.EXIT_WITH_STATUS = 1;
|
||||||
if (!sb)
|
if (!sb)
|
||||||
DIFF_OPT_SET(&opt, QUICK);
|
opt.flags.QUICK = 1;
|
||||||
do_diff_cache(&head, &opt);
|
do_diff_cache(&head, &opt);
|
||||||
diffcore_std(&opt);
|
diffcore_std(&opt);
|
||||||
for (i = 0; sb && i < diff_queued_diff.nr; i++) {
|
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.show_root_diff = 1;
|
||||||
rev_info.diffopt.output_format = DIFF_FORMAT_PATCH;
|
rev_info.diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
rev_info.no_commit_id = 1;
|
rev_info.no_commit_id = 1;
|
||||||
DIFF_OPT_SET(&rev_info.diffopt, BINARY);
|
rev_info.diffopt.flags.BINARY = 1;
|
||||||
DIFF_OPT_SET(&rev_info.diffopt, FULL_INDEX);
|
rev_info.diffopt.flags.FULL_INDEX = 1;
|
||||||
rev_info.diffopt.use_color = 0;
|
rev_info.diffopt.use_color = 0;
|
||||||
rev_info.diffopt.file = fp;
|
rev_info.diffopt.file = fp;
|
||||||
rev_info.diffopt.close_file = 1;
|
rev_info.diffopt.close_file = 1;
|
||||||
|
@ -708,8 +708,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
|||||||
git_config(git_blame_config, &output_option);
|
git_config(git_blame_config, &output_option);
|
||||||
init_revisions(&revs, NULL);
|
init_revisions(&revs, NULL);
|
||||||
revs.date_mode = blame_date_mode;
|
revs.date_mode = blame_date_mode;
|
||||||
DIFF_OPT_SET(&revs.diffopt, ALLOW_TEXTCONV);
|
revs.diffopt.flags.ALLOW_TEXTCONV = 1;
|
||||||
DIFF_OPT_SET(&revs.diffopt, FOLLOW_RENAMES);
|
revs.diffopt.flags.FOLLOW_RENAMES = 1;
|
||||||
|
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
dashdash_pos = 0;
|
dashdash_pos = 0;
|
||||||
|
@ -350,8 +350,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||||||
rev.diffopt.stat_graph_width = -1;
|
rev.diffopt.stat_graph_width = -1;
|
||||||
|
|
||||||
/* Default to let external and textconv be used */
|
/* Default to let external and textconv be used */
|
||||||
DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
|
rev.diffopt.flags.ALLOW_EXTERNAL = 1;
|
||||||
DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
|
rev.diffopt.flags.ALLOW_TEXTCONV = 1;
|
||||||
|
|
||||||
if (nongit)
|
if (nongit)
|
||||||
die(_("Not a git repository"));
|
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_setup_done(&rev.diffopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
|
rev.diffopt.flags.RECURSIVE = 1;
|
||||||
|
|
||||||
setup_diff_pager(&rev.diffopt);
|
setup_diff_pager(&rev.diffopt);
|
||||||
|
|
||||||
|
@ -1066,7 +1066,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
|
|||||||
die("revision walk setup failed");
|
die("revision walk setup failed");
|
||||||
revs.diffopt.format_callback = show_filemodify;
|
revs.diffopt.format_callback = show_filemodify;
|
||||||
revs.diffopt.format_callback_data = &paths_of_changed_objects;
|
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))) {
|
while ((commit = get_revision(&revs))) {
|
||||||
if (has_unshown_parent(commit)) {
|
if (has_unshown_parent(commit)) {
|
||||||
add_object_array(&commit->object, NULL, &commits);
|
add_object_array(&commit->object, NULL, &commits);
|
||||||
|
@ -121,16 +121,16 @@ static void cmd_log_init_defaults(struct rev_info *rev)
|
|||||||
if (fmt_pretty)
|
if (fmt_pretty)
|
||||||
get_commit_format(fmt_pretty, rev);
|
get_commit_format(fmt_pretty, rev);
|
||||||
if (default_follow)
|
if (default_follow)
|
||||||
DIFF_OPT_SET(&rev->diffopt, DEFAULT_FOLLOW_RENAMES);
|
rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES = 1;
|
||||||
rev->verbose_header = 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_width = -1; /* use full terminal width */
|
||||||
rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
|
rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
|
||||||
rev->abbrev_commit = default_abbrev_commit;
|
rev->abbrev_commit = default_abbrev_commit;
|
||||||
rev->show_root_diff = default_show_root;
|
rev->show_root_diff = default_show_root;
|
||||||
rev->subject_prefix = fmt_patch_subject_prefix;
|
rev->subject_prefix = fmt_patch_subject_prefix;
|
||||||
rev->show_signature = default_show_signature;
|
rev->show_signature = default_show_signature;
|
||||||
DIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);
|
rev->diffopt.flags.ALLOW_TEXTCONV = 1;
|
||||||
|
|
||||||
if (default_date_mode)
|
if (default_date_mode)
|
||||||
parse_date_format(default_date_mode, &rev->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 &&
|
if (rev->diffopt.flags.DEFAULT_FOLLOW_RENAMES &&
|
||||||
rev->prune_data.nr == 1)
|
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 */
|
/* Turn --cc/-c into -p --cc/-c when -p was not given */
|
||||||
if (!rev->diffopt.output_format && rev->combine_merges)
|
if (!rev->diffopt.output_format && rev->combine_merges)
|
||||||
@ -1340,7 +1340,7 @@ static void prepare_bases(struct base_tree_info *bases,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
diff_setup(&diffopt);
|
diff_setup(&diffopt);
|
||||||
DIFF_OPT_SET(&diffopt, RECURSIVE);
|
diffopt.flags.RECURSIVE = 1;
|
||||||
diff_setup_done(&diffopt);
|
diff_setup_done(&diffopt);
|
||||||
|
|
||||||
oidcpy(&bases->base_commit, &base->object.oid);
|
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.verbose_header = 1;
|
||||||
rev.diff = 1;
|
rev.diff = 1;
|
||||||
rev.max_parents = 1;
|
rev.max_parents = 1;
|
||||||
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
|
rev.diffopt.flags.RECURSIVE = 1;
|
||||||
rev.subject_prefix = fmt_patch_subject_prefix;
|
rev.subject_prefix = fmt_patch_subject_prefix;
|
||||||
memset(&s_r_opt, 0, sizeof(s_r_opt));
|
memset(&s_r_opt, 0, sizeof(s_r_opt));
|
||||||
s_r_opt.def = "HEAD";
|
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;
|
rev.zero_commit = zero_commit;
|
||||||
|
|
||||||
if (!rev.diffopt.flags.TEXT && !no_binary_diff)
|
if (!rev.diffopt.flags.TEXT && !no_binary_diff)
|
||||||
DIFF_OPT_SET(&rev.diffopt, BINARY);
|
rev.diffopt.flags.BINARY = 1;
|
||||||
|
|
||||||
if (rev.show_notes)
|
if (rev.show_notes)
|
||||||
init_display_notes(&rev.notes_opt);
|
init_display_notes(&rev.notes_opt);
|
||||||
|
@ -166,7 +166,7 @@ static int read_from_tree(const struct pathspec *pathspec,
|
|||||||
opt.output_format = DIFF_FORMAT_CALLBACK;
|
opt.output_format = DIFF_FORMAT_CALLBACK;
|
||||||
opt.format_callback = update_index_from_diff;
|
opt.format_callback = update_index_from_diff;
|
||||||
opt.format_callback_data = &intent_to_add;
|
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))
|
if (do_diff_cache(tree_oid, &opt))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1413,7 +1413,7 @@ void diff_tree_combined(const struct object_id *oid,
|
|||||||
|
|
||||||
diffopts = *opt;
|
diffopts = *opt;
|
||||||
copy_pathspec(&diffopts.pathspec, &opt->pathspec);
|
copy_pathspec(&diffopts.pathspec, &opt->pathspec);
|
||||||
DIFF_OPT_SET(&diffopts, RECURSIVE);
|
diffopts.flags.RECURSIVE = 1;
|
||||||
DIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL);
|
DIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL);
|
||||||
|
|
||||||
/* find set of paths that everybody touches
|
/* find set of paths that everybody touches
|
||||||
|
@ -545,8 +545,8 @@ int index_differs_from(const char *def, const struct diff_flags *flags,
|
|||||||
memset(&opt, 0, sizeof(opt));
|
memset(&opt, 0, sizeof(opt));
|
||||||
opt.def = def;
|
opt.def = def;
|
||||||
setup_revisions(0, NULL, &rev, &opt);
|
setup_revisions(0, NULL, &rev, &opt);
|
||||||
DIFF_OPT_SET(&rev.diffopt, QUICK);
|
rev.diffopt.flags.QUICK = 1;
|
||||||
DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS);
|
rev.diffopt.flags.EXIT_WITH_STATUS = 1;
|
||||||
if (flags)
|
if (flags)
|
||||||
diff_flags_or(&rev.diffopt.flags, flags);
|
diff_flags_or(&rev.diffopt.flags, flags);
|
||||||
rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
|
rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
|
||||||
|
@ -276,16 +276,16 @@ void diff_no_index(struct rev_info *revs,
|
|||||||
if (!revs->diffopt.output_format)
|
if (!revs->diffopt.output_format)
|
||||||
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
|
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
|
|
||||||
DIFF_OPT_SET(&revs->diffopt, NO_INDEX);
|
revs->diffopt.flags.NO_INDEX = 1;
|
||||||
|
|
||||||
DIFF_OPT_SET(&revs->diffopt, RELATIVE_NAME);
|
revs->diffopt.flags.RELATIVE_NAME = 1;
|
||||||
revs->diffopt.prefix = prefix;
|
revs->diffopt.prefix = prefix;
|
||||||
|
|
||||||
revs->max_count = -2;
|
revs->max_count = -2;
|
||||||
diff_setup_done(&revs->diffopt);
|
diff_setup_done(&revs->diffopt);
|
||||||
|
|
||||||
setup_diff_pager(&revs->diffopt);
|
setup_diff_pager(&revs->diffopt);
|
||||||
DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
|
revs->diffopt.flags.EXIT_WITH_STATUS = 1;
|
||||||
|
|
||||||
if (queue_diff(&revs->diffopt, paths[0], paths[1]))
|
if (queue_diff(&revs->diffopt, paths[0], paths[1]))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
66
diff.c
66
diff.c
@ -127,15 +127,15 @@ static int parse_dirstat_params(struct diff_options *options, const char *params
|
|||||||
DIFF_OPT_CLR(options, DIRSTAT_BY_LINE);
|
DIFF_OPT_CLR(options, DIRSTAT_BY_LINE);
|
||||||
DIFF_OPT_CLR(options, DIRSTAT_BY_FILE);
|
DIFF_OPT_CLR(options, DIRSTAT_BY_FILE);
|
||||||
} else if (!strcmp(p, "lines")) {
|
} else if (!strcmp(p, "lines")) {
|
||||||
DIFF_OPT_SET(options, DIRSTAT_BY_LINE);
|
options->flags.DIRSTAT_BY_LINE = 1;
|
||||||
DIFF_OPT_CLR(options, DIRSTAT_BY_FILE);
|
DIFF_OPT_CLR(options, DIRSTAT_BY_FILE);
|
||||||
} else if (!strcmp(p, "files")) {
|
} else if (!strcmp(p, "files")) {
|
||||||
DIFF_OPT_CLR(options, DIRSTAT_BY_LINE);
|
DIFF_OPT_CLR(options, DIRSTAT_BY_LINE);
|
||||||
DIFF_OPT_SET(options, DIRSTAT_BY_FILE);
|
options->flags.DIRSTAT_BY_FILE = 1;
|
||||||
} else if (!strcmp(p, "noncumulative")) {
|
} else if (!strcmp(p, "noncumulative")) {
|
||||||
DIFF_OPT_CLR(options, DIRSTAT_CUMULATIVE);
|
DIFF_OPT_CLR(options, DIRSTAT_CUMULATIVE);
|
||||||
} else if (!strcmp(p, "cumulative")) {
|
} else if (!strcmp(p, "cumulative")) {
|
||||||
DIFF_OPT_SET(options, DIRSTAT_CUMULATIVE);
|
options->flags.DIRSTAT_CUMULATIVE = 1;
|
||||||
} else if (isdigit(*p)) {
|
} else if (isdigit(*p)) {
|
||||||
char *end;
|
char *end;
|
||||||
int permille = strtoul(p, &end, 10) * 10;
|
int permille = strtoul(p, &end, 10) * 10;
|
||||||
@ -3447,7 +3447,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
|
|||||||
diff_free_filespec_data(one);
|
diff_free_filespec_data(one);
|
||||||
diff_free_filespec_data(two);
|
diff_free_filespec_data(two);
|
||||||
if (data.status)
|
if (data.status)
|
||||||
DIFF_OPT_SET(o, CHECK_FAILED);
|
o->flags.CHECK_FAILED = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct diff_filespec *alloc_filespec(const char *path)
|
struct diff_filespec *alloc_filespec(const char *path)
|
||||||
@ -4152,7 +4152,7 @@ void diff_setup(struct diff_options *options)
|
|||||||
options->context = diff_context_default;
|
options->context = diff_context_default;
|
||||||
options->interhunkcontext = diff_interhunk_context_default;
|
options->interhunkcontext = diff_interhunk_context_default;
|
||||||
options->ws_error_highlight = ws_error_highlight_default;
|
options->ws_error_highlight = ws_error_highlight_default;
|
||||||
DIFF_OPT_SET(options, RENAME_EMPTY);
|
options->flags.RENAME_EMPTY = 1;
|
||||||
|
|
||||||
/* pathchange left =NULL by default */
|
/* pathchange left =NULL by default */
|
||||||
options->change = diff_change;
|
options->change = diff_change;
|
||||||
@ -4203,7 +4203,7 @@ void diff_setup_done(struct diff_options *options)
|
|||||||
if (DIFF_XDL_TST(options, IGNORE_WHITESPACE) ||
|
if (DIFF_XDL_TST(options, IGNORE_WHITESPACE) ||
|
||||||
DIFF_XDL_TST(options, IGNORE_WHITESPACE_CHANGE) ||
|
DIFF_XDL_TST(options, IGNORE_WHITESPACE_CHANGE) ||
|
||||||
DIFF_XDL_TST(options, IGNORE_WHITESPACE_AT_EOL))
|
DIFF_XDL_TST(options, IGNORE_WHITESPACE_AT_EOL))
|
||||||
DIFF_OPT_SET(options, DIFF_FROM_CONTENTS);
|
options->flags.DIFF_FROM_CONTENTS = 1;
|
||||||
else
|
else
|
||||||
DIFF_OPT_CLR(options, DIFF_FROM_CONTENTS);
|
DIFF_OPT_CLR(options, DIFF_FROM_CONTENTS);
|
||||||
|
|
||||||
@ -4240,18 +4240,18 @@ void diff_setup_done(struct diff_options *options)
|
|||||||
DIFF_FORMAT_DIRSTAT |
|
DIFF_FORMAT_DIRSTAT |
|
||||||
DIFF_FORMAT_SUMMARY |
|
DIFF_FORMAT_SUMMARY |
|
||||||
DIFF_FORMAT_CHECKDIFF))
|
DIFF_FORMAT_CHECKDIFF))
|
||||||
DIFF_OPT_SET(options, RECURSIVE);
|
options->flags.RECURSIVE = 1;
|
||||||
/*
|
/*
|
||||||
* Also pickaxe would not work very well if you do not say recursive
|
* Also pickaxe would not work very well if you do not say recursive
|
||||||
*/
|
*/
|
||||||
if (options->pickaxe)
|
if (options->pickaxe)
|
||||||
DIFF_OPT_SET(options, RECURSIVE);
|
options->flags.RECURSIVE = 1;
|
||||||
/*
|
/*
|
||||||
* When patches are generated, submodules diffed against the work tree
|
* When patches are generated, submodules diffed against the work tree
|
||||||
* must be checked for dirtiness too so it can be shown in the output
|
* must be checked for dirtiness too so it can be shown in the output
|
||||||
*/
|
*/
|
||||||
if (options->output_format & DIFF_FORMAT_PATCH)
|
if (options->output_format & DIFF_FORMAT_PATCH)
|
||||||
DIFF_OPT_SET(options, DIRTY_SUBMODULES);
|
options->flags.DIRTY_SUBMODULES = 1;
|
||||||
|
|
||||||
if (options->detect_rename && options->rename_limit < 0)
|
if (options->detect_rename && options->rename_limit < 0)
|
||||||
options->rename_limit = diff_rename_limit_default;
|
options->rename_limit = diff_rename_limit_default;
|
||||||
@ -4275,7 +4275,7 @@ void diff_setup_done(struct diff_options *options)
|
|||||||
*/
|
*/
|
||||||
if (options->flags.QUICK) {
|
if (options->flags.QUICK) {
|
||||||
options->output_format = DIFF_FORMAT_NO_OUTPUT;
|
options->output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
|
options->flags.EXIT_WITH_STATUS = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
options->diff_path_counter = 0;
|
options->diff_path_counter = 0;
|
||||||
@ -4630,7 +4630,7 @@ int diff_opt_parse(struct diff_options *options,
|
|||||||
else if (starts_with(arg, "-C") || starts_with(arg, "--find-copies=") ||
|
else if (starts_with(arg, "-C") || starts_with(arg, "--find-copies=") ||
|
||||||
!strcmp(arg, "--find-copies")) {
|
!strcmp(arg, "--find-copies")) {
|
||||||
if (options->detect_rename == DIFF_DETECT_COPY)
|
if (options->detect_rename == DIFF_DETECT_COPY)
|
||||||
DIFF_OPT_SET(options, FIND_COPIES_HARDER);
|
options->flags.FIND_COPIES_HARDER = 1;
|
||||||
if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
|
if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
|
||||||
return error("invalid argument to -C: %s", arg+2);
|
return error("invalid argument to -C: %s", arg+2);
|
||||||
options->detect_rename = DIFF_DETECT_COPY;
|
options->detect_rename = DIFF_DETECT_COPY;
|
||||||
@ -4638,13 +4638,13 @@ int diff_opt_parse(struct diff_options *options,
|
|||||||
else if (!strcmp(arg, "--no-renames"))
|
else if (!strcmp(arg, "--no-renames"))
|
||||||
options->detect_rename = 0;
|
options->detect_rename = 0;
|
||||||
else if (!strcmp(arg, "--rename-empty"))
|
else if (!strcmp(arg, "--rename-empty"))
|
||||||
DIFF_OPT_SET(options, RENAME_EMPTY);
|
options->flags.RENAME_EMPTY = 1;
|
||||||
else if (!strcmp(arg, "--no-rename-empty"))
|
else if (!strcmp(arg, "--no-rename-empty"))
|
||||||
DIFF_OPT_CLR(options, RENAME_EMPTY);
|
DIFF_OPT_CLR(options, RENAME_EMPTY);
|
||||||
else if (!strcmp(arg, "--relative"))
|
else if (!strcmp(arg, "--relative"))
|
||||||
DIFF_OPT_SET(options, RELATIVE_NAME);
|
options->flags.RELATIVE_NAME = 1;
|
||||||
else if (skip_prefix(arg, "--relative=", &arg)) {
|
else if (skip_prefix(arg, "--relative=", &arg)) {
|
||||||
DIFF_OPT_SET(options, RELATIVE_NAME);
|
options->flags.RELATIVE_NAME = 1;
|
||||||
options->prefix = arg;
|
options->prefix = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4684,18 +4684,18 @@ int diff_opt_parse(struct diff_options *options,
|
|||||||
/* flags options */
|
/* flags options */
|
||||||
else if (!strcmp(arg, "--binary")) {
|
else if (!strcmp(arg, "--binary")) {
|
||||||
enable_patch_output(&options->output_format);
|
enable_patch_output(&options->output_format);
|
||||||
DIFF_OPT_SET(options, BINARY);
|
options->flags.BINARY = 1;
|
||||||
}
|
}
|
||||||
else if (!strcmp(arg, "--full-index"))
|
else if (!strcmp(arg, "--full-index"))
|
||||||
DIFF_OPT_SET(options, FULL_INDEX);
|
options->flags.FULL_INDEX = 1;
|
||||||
else if (!strcmp(arg, "-a") || !strcmp(arg, "--text"))
|
else if (!strcmp(arg, "-a") || !strcmp(arg, "--text"))
|
||||||
DIFF_OPT_SET(options, TEXT);
|
options->flags.TEXT = 1;
|
||||||
else if (!strcmp(arg, "-R"))
|
else if (!strcmp(arg, "-R"))
|
||||||
DIFF_OPT_SET(options, REVERSE_DIFF);
|
options->flags.REVERSE_DIFF = 1;
|
||||||
else if (!strcmp(arg, "--find-copies-harder"))
|
else if (!strcmp(arg, "--find-copies-harder"))
|
||||||
DIFF_OPT_SET(options, FIND_COPIES_HARDER);
|
options->flags.FIND_COPIES_HARDER = 1;
|
||||||
else if (!strcmp(arg, "--follow"))
|
else if (!strcmp(arg, "--follow"))
|
||||||
DIFF_OPT_SET(options, FOLLOW_RENAMES);
|
options->flags.FOLLOW_RENAMES = 1;
|
||||||
else if (!strcmp(arg, "--no-follow")) {
|
else if (!strcmp(arg, "--no-follow")) {
|
||||||
DIFF_OPT_CLR(options, FOLLOW_RENAMES);
|
DIFF_OPT_CLR(options, FOLLOW_RENAMES);
|
||||||
DIFF_OPT_CLR(options, DEFAULT_FOLLOW_RENAMES);
|
DIFF_OPT_CLR(options, DEFAULT_FOLLOW_RENAMES);
|
||||||
@ -4755,23 +4755,23 @@ int diff_opt_parse(struct diff_options *options,
|
|||||||
return argcount;
|
return argcount;
|
||||||
}
|
}
|
||||||
else if (!strcmp(arg, "--exit-code"))
|
else if (!strcmp(arg, "--exit-code"))
|
||||||
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
|
options->flags.EXIT_WITH_STATUS = 1;
|
||||||
else if (!strcmp(arg, "--quiet"))
|
else if (!strcmp(arg, "--quiet"))
|
||||||
DIFF_OPT_SET(options, QUICK);
|
options->flags.QUICK = 1;
|
||||||
else if (!strcmp(arg, "--ext-diff"))
|
else if (!strcmp(arg, "--ext-diff"))
|
||||||
DIFF_OPT_SET(options, ALLOW_EXTERNAL);
|
options->flags.ALLOW_EXTERNAL = 1;
|
||||||
else if (!strcmp(arg, "--no-ext-diff"))
|
else if (!strcmp(arg, "--no-ext-diff"))
|
||||||
DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
|
DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
|
||||||
else if (!strcmp(arg, "--textconv")) {
|
else if (!strcmp(arg, "--textconv")) {
|
||||||
DIFF_OPT_SET(options, ALLOW_TEXTCONV);
|
options->flags.ALLOW_TEXTCONV = 1;
|
||||||
DIFF_OPT_SET(options, TEXTCONV_SET_VIA_CMDLINE);
|
options->flags.TEXTCONV_SET_VIA_CMDLINE = 1;
|
||||||
} else if (!strcmp(arg, "--no-textconv"))
|
} else if (!strcmp(arg, "--no-textconv"))
|
||||||
DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
|
DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
|
||||||
else if (!strcmp(arg, "--ignore-submodules")) {
|
else if (!strcmp(arg, "--ignore-submodules")) {
|
||||||
DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
|
options->flags.OVERRIDE_SUBMODULE_CONFIG = 1;
|
||||||
handle_ignore_submodules_arg(options, "all");
|
handle_ignore_submodules_arg(options, "all");
|
||||||
} else if (skip_prefix(arg, "--ignore-submodules=", &arg)) {
|
} else if (skip_prefix(arg, "--ignore-submodules=", &arg)) {
|
||||||
DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
|
options->flags.OVERRIDE_SUBMODULE_CONFIG = 1;
|
||||||
handle_ignore_submodules_arg(options, arg);
|
handle_ignore_submodules_arg(options, arg);
|
||||||
} else if (!strcmp(arg, "--submodule"))
|
} else if (!strcmp(arg, "--submodule"))
|
||||||
options->submodule_format = DIFF_SUBMODULE_LOG;
|
options->submodule_format = DIFF_SUBMODULE_LOG;
|
||||||
@ -4846,9 +4846,9 @@ int diff_opt_parse(struct diff_options *options,
|
|||||||
&options->interhunkcontext))
|
&options->interhunkcontext))
|
||||||
;
|
;
|
||||||
else if (!strcmp(arg, "-W"))
|
else if (!strcmp(arg, "-W"))
|
||||||
DIFF_OPT_SET(options, FUNCCONTEXT);
|
options->flags.FUNCCONTEXT = 1;
|
||||||
else if (!strcmp(arg, "--function-context"))
|
else if (!strcmp(arg, "--function-context"))
|
||||||
DIFF_OPT_SET(options, FUNCCONTEXT);
|
options->flags.FUNCCONTEXT = 1;
|
||||||
else if (!strcmp(arg, "--no-function-context"))
|
else if (!strcmp(arg, "--no-function-context"))
|
||||||
DIFF_OPT_CLR(options, FUNCCONTEXT);
|
DIFF_OPT_CLR(options, FUNCCONTEXT);
|
||||||
else if ((argcount = parse_long_opt("output", av, &optarg))) {
|
else if ((argcount = parse_long_opt("output", av, &optarg))) {
|
||||||
@ -5686,7 +5686,7 @@ free_queue:
|
|||||||
*/
|
*/
|
||||||
if (options->flags.DIFF_FROM_CONTENTS) {
|
if (options->flags.DIFF_FROM_CONTENTS) {
|
||||||
if (options->found_changes)
|
if (options->found_changes)
|
||||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
options->flags.HAS_CHANGES = 1;
|
||||||
else
|
else
|
||||||
DIFF_OPT_CLR(options, HAS_CHANGES);
|
DIFF_OPT_CLR(options, HAS_CHANGES);
|
||||||
}
|
}
|
||||||
@ -5858,7 +5858,7 @@ void diffcore_std(struct diff_options *options)
|
|||||||
diffcore_apply_filter(options);
|
diffcore_apply_filter(options);
|
||||||
|
|
||||||
if (diff_queued_diff.nr && !options->flags.DIFF_FROM_CONTENTS)
|
if (diff_queued_diff.nr && !options->flags.DIFF_FROM_CONTENTS)
|
||||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
options->flags.HAS_CHANGES = 1;
|
||||||
else
|
else
|
||||||
DIFF_OPT_CLR(options, HAS_CHANGES);
|
DIFF_OPT_CLR(options, HAS_CHANGES);
|
||||||
|
|
||||||
@ -5952,7 +5952,7 @@ void diff_addremove(struct diff_options *options,
|
|||||||
|
|
||||||
diff_queue(&diff_queued_diff, one, two);
|
diff_queue(&diff_queued_diff, one, two);
|
||||||
if (!options->flags.DIFF_FROM_CONTENTS)
|
if (!options->flags.DIFF_FROM_CONTENTS)
|
||||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
options->flags.HAS_CHANGES = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void diff_change(struct diff_options *options,
|
void diff_change(struct diff_options *options,
|
||||||
@ -5996,7 +5996,7 @@ void diff_change(struct diff_options *options,
|
|||||||
!diff_filespec_check_stat_unmatch(p))
|
!diff_filespec_check_stat_unmatch(p))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
options->flags.HAS_CHANGES = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct diff_filepair *diff_unmerge(struct diff_options *options, const char *path)
|
struct diff_filepair *diff_unmerge(struct diff_options *options, const char *path)
|
||||||
|
1
diff.h
1
diff.h
@ -106,7 +106,6 @@ static inline void diff_flags_or(struct diff_flags *a,
|
|||||||
tmp_a[i] |= tmp_b[i];
|
tmp_a[i] |= tmp_b[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DIFF_OPT_SET(opts, flag) ((opts)->flags.flag = 1)
|
|
||||||
#define DIFF_OPT_CLR(opts, flag) ((opts)->flags.flag = 0)
|
#define DIFF_OPT_CLR(opts, flag) ((opts)->flags.flag = 0)
|
||||||
|
|
||||||
#define DIFF_XDL_TST(opts, flag) ((opts)->xdl_opts & XDF_##flag)
|
#define DIFF_XDL_TST(opts, flag) ((opts)->xdl_opts & XDF_##flag)
|
||||||
|
@ -540,7 +540,7 @@ static struct string_list *get_renames(struct merge_options *o,
|
|||||||
return renames;
|
return renames;
|
||||||
|
|
||||||
diff_setup(&opts);
|
diff_setup(&opts);
|
||||||
DIFF_OPT_SET(&opts, RECURSIVE);
|
opts.flags.RECURSIVE = 1;
|
||||||
DIFF_OPT_CLR(&opts, RENAME_EMPTY);
|
DIFF_OPT_CLR(&opts, RENAME_EMPTY);
|
||||||
opts.detect_rename = DIFF_DETECT_RENAME;
|
opts.detect_rename = DIFF_DETECT_RENAME;
|
||||||
opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
|
opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
|
||||||
|
@ -125,7 +125,7 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
|
|||||||
oid_to_hex(base), oid_to_hex(remote));
|
oid_to_hex(base), oid_to_hex(remote));
|
||||||
|
|
||||||
diff_setup(&opt);
|
diff_setup(&opt);
|
||||||
DIFF_OPT_SET(&opt, RECURSIVE);
|
opt.flags.RECURSIVE = 1;
|
||||||
opt.output_format = DIFF_FORMAT_NO_OUTPUT;
|
opt.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
diff_setup_done(&opt);
|
diff_setup_done(&opt);
|
||||||
diff_tree_oid(base, remote, "", &opt);
|
diff_tree_oid(base, remote, "", &opt);
|
||||||
@ -188,7 +188,7 @@ static void diff_tree_local(struct notes_merge_options *o,
|
|||||||
len, oid_to_hex(base), oid_to_hex(local));
|
len, oid_to_hex(base), oid_to_hex(local));
|
||||||
|
|
||||||
diff_setup(&opt);
|
diff_setup(&opt);
|
||||||
DIFF_OPT_SET(&opt, RECURSIVE);
|
opt.flags.RECURSIVE = 1;
|
||||||
opt.output_format = DIFF_FORMAT_NO_OUTPUT;
|
opt.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
diff_setup_done(&opt);
|
diff_setup_done(&opt);
|
||||||
diff_tree_oid(base, local, "", &opt);
|
diff_tree_oid(base, local, "", &opt);
|
||||||
|
@ -61,7 +61,7 @@ int init_patch_ids(struct patch_ids *ids)
|
|||||||
memset(ids, 0, sizeof(*ids));
|
memset(ids, 0, sizeof(*ids));
|
||||||
diff_setup(&ids->diffopts);
|
diff_setup(&ids->diffopts);
|
||||||
ids->diffopts.detect_rename = 0;
|
ids->diffopts.detect_rename = 0;
|
||||||
DIFF_OPT_SET(&ids->diffopts, RECURSIVE);
|
ids->diffopts.flags.RECURSIVE = 1;
|
||||||
diff_setup_done(&ids->diffopts);
|
diff_setup_done(&ids->diffopts);
|
||||||
hashmap_init(&ids->patches, patch_id_cmp, &ids->diffopts, 256);
|
hashmap_init(&ids->patches, patch_id_cmp, &ids->diffopts, 256);
|
||||||
return 0;
|
return 0;
|
||||||
|
16
revision.c
16
revision.c
@ -410,7 +410,7 @@ static void file_add_remove(struct diff_options *options,
|
|||||||
|
|
||||||
tree_difference |= diff;
|
tree_difference |= diff;
|
||||||
if (tree_difference == REV_TREE_DIFFERENT)
|
if (tree_difference == REV_TREE_DIFFERENT)
|
||||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
options->flags.HAS_CHANGES = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void file_change(struct diff_options *options,
|
static void file_change(struct diff_options *options,
|
||||||
@ -422,7 +422,7 @@ static void file_change(struct diff_options *options,
|
|||||||
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
||||||
{
|
{
|
||||||
tree_difference = REV_TREE_DIFFERENT;
|
tree_difference = REV_TREE_DIFFERENT;
|
||||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
options->flags.HAS_CHANGES = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rev_compare_tree(struct rev_info *revs,
|
static int rev_compare_tree(struct rev_info *revs,
|
||||||
@ -1403,8 +1403,8 @@ void init_revisions(struct rev_info *revs, const char *prefix)
|
|||||||
revs->abbrev = DEFAULT_ABBREV;
|
revs->abbrev = DEFAULT_ABBREV;
|
||||||
revs->ignore_merges = 1;
|
revs->ignore_merges = 1;
|
||||||
revs->simplify_history = 1;
|
revs->simplify_history = 1;
|
||||||
DIFF_OPT_SET(&revs->pruning, RECURSIVE);
|
revs->pruning.flags.RECURSIVE = 1;
|
||||||
DIFF_OPT_SET(&revs->pruning, QUICK);
|
revs->pruning.flags.QUICK = 1;
|
||||||
revs->pruning.add_remove = file_add_remove;
|
revs->pruning.add_remove = file_add_remove;
|
||||||
revs->pruning.change = file_change;
|
revs->pruning.change = file_change;
|
||||||
revs->sort_order = REV_SORT_IN_GRAPH_ORDER;
|
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
|
|||||||
die("--unpacked=<packfile> no longer supported.");
|
die("--unpacked=<packfile> no longer supported.");
|
||||||
} else if (!strcmp(arg, "-r")) {
|
} else if (!strcmp(arg, "-r")) {
|
||||||
revs->diff = 1;
|
revs->diff = 1;
|
||||||
DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
|
revs->diffopt.flags.RECURSIVE = 1;
|
||||||
} else if (!strcmp(arg, "-t")) {
|
} else if (!strcmp(arg, "-t")) {
|
||||||
revs->diff = 1;
|
revs->diff = 1;
|
||||||
DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
|
revs->diffopt.flags.RECURSIVE = 1;
|
||||||
DIFF_OPT_SET(&revs->diffopt, TREE_IN_RECURSIVE);
|
revs->diffopt.flags.TREE_IN_RECURSIVE = 1;
|
||||||
} else if (!strcmp(arg, "-m")) {
|
} else if (!strcmp(arg, "-m")) {
|
||||||
revs->ignore_merges = 0;
|
revs->ignore_merges = 0;
|
||||||
} else if (!strcmp(arg, "-c")) {
|
} else if (!strcmp(arg, "-c")) {
|
||||||
@ -2066,7 +2066,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
|||||||
revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_ERE;
|
revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_ERE;
|
||||||
} else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
|
} else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
|
||||||
revs->grep_filter.ignore_case = 1;
|
revs->grep_filter.ignore_case = 1;
|
||||||
DIFF_OPT_SET(&revs->diffopt, PICKAXE_IGNORE_CASE);
|
revs->diffopt.flags.PICKAXE_IGNORE_CASE = 1;
|
||||||
} else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
|
} else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
|
||||||
revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_FIXED;
|
revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_FIXED;
|
||||||
} else if (!strcmp(arg, "--perl-regexp") || !strcmp(arg, "-P")) {
|
} else if (!strcmp(arg, "--perl-regexp") || !strcmp(arg, "-P")) {
|
||||||
|
@ -183,7 +183,7 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
|
|||||||
if (ignore)
|
if (ignore)
|
||||||
handle_ignore_submodules_arg(diffopt, ignore);
|
handle_ignore_submodules_arg(diffopt, ignore);
|
||||||
else if (is_gitmodules_unmerged(&the_index))
|
else if (is_gitmodules_unmerged(&the_index))
|
||||||
DIFF_OPT_SET(diffopt, IGNORE_SUBMODULES);
|
diffopt->flags.IGNORE_SUBMODULES = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,11 +407,11 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
|
|||||||
DIFF_OPT_CLR(diffopt, IGNORE_DIRTY_SUBMODULES);
|
DIFF_OPT_CLR(diffopt, IGNORE_DIRTY_SUBMODULES);
|
||||||
|
|
||||||
if (!strcmp(arg, "all"))
|
if (!strcmp(arg, "all"))
|
||||||
DIFF_OPT_SET(diffopt, IGNORE_SUBMODULES);
|
diffopt->flags.IGNORE_SUBMODULES = 1;
|
||||||
else if (!strcmp(arg, "untracked"))
|
else if (!strcmp(arg, "untracked"))
|
||||||
DIFF_OPT_SET(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);
|
diffopt->flags.IGNORE_UNTRACKED_IN_SUBMODULES = 1;
|
||||||
else if (!strcmp(arg, "dirty"))
|
else if (!strcmp(arg, "dirty"))
|
||||||
DIFF_OPT_SET(diffopt, IGNORE_DIRTY_SUBMODULES);
|
diffopt->flags.IGNORE_DIRTY_SUBMODULES = 1;
|
||||||
else if (strcmp(arg, "none"))
|
else if (strcmp(arg, "none"))
|
||||||
die("bad --ignore-submodules argument: %s", arg);
|
die("bad --ignore-submodules argument: %s", arg);
|
||||||
}
|
}
|
||||||
|
@ -608,8 +608,8 @@ static void try_to_follow_renames(const struct object_id *old_oid,
|
|||||||
q->nr = 0;
|
q->nr = 0;
|
||||||
|
|
||||||
diff_setup(&diff_opts);
|
diff_setup(&diff_opts);
|
||||||
DIFF_OPT_SET(&diff_opts, RECURSIVE);
|
diff_opts.flags.RECURSIVE = 1;
|
||||||
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
|
diff_opts.flags.FIND_COPIES_HARDER = 1;
|
||||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
diff_opts.single_follow = opt->pathspec.items[0].match;
|
diff_opts.single_follow = opt->pathspec.items[0].match;
|
||||||
diff_opts.break_opt = opt->break_opt;
|
diff_opts.break_opt = opt->break_opt;
|
||||||
|
18
wt-status.c
18
wt-status.c
@ -559,12 +559,12 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
|
|||||||
init_revisions(&rev, NULL);
|
init_revisions(&rev, NULL);
|
||||||
setup_revisions(0, NULL, &rev, NULL);
|
setup_revisions(0, NULL, &rev, NULL);
|
||||||
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
|
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
|
||||||
DIFF_OPT_SET(&rev.diffopt, DIRTY_SUBMODULES);
|
rev.diffopt.flags.DIRTY_SUBMODULES = 1;
|
||||||
rev.diffopt.ita_invisible_in_index = 1;
|
rev.diffopt.ita_invisible_in_index = 1;
|
||||||
if (!s->show_untracked_files)
|
if (!s->show_untracked_files)
|
||||||
DIFF_OPT_SET(&rev.diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);
|
rev.diffopt.flags.IGNORE_UNTRACKED_IN_SUBMODULES = 1;
|
||||||
if (s->ignore_submodule_arg) {
|
if (s->ignore_submodule_arg) {
|
||||||
DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
|
rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
|
||||||
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
|
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
|
||||||
}
|
}
|
||||||
rev.diffopt.format_callback = wt_status_collect_changed_cb;
|
rev.diffopt.format_callback = wt_status_collect_changed_cb;
|
||||||
@ -583,7 +583,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)
|
|||||||
opt.def = s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference;
|
opt.def = s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference;
|
||||||
setup_revisions(0, NULL, &rev, &opt);
|
setup_revisions(0, NULL, &rev, &opt);
|
||||||
|
|
||||||
DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
|
rev.diffopt.flags.OVERRIDE_SUBMODULE_CONFIG = 1;
|
||||||
rev.diffopt.ita_invisible_in_index = 1;
|
rev.diffopt.ita_invisible_in_index = 1;
|
||||||
if (s->ignore_submodule_arg) {
|
if (s->ignore_submodule_arg) {
|
||||||
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
|
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
|
||||||
@ -949,7 +949,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s)
|
|||||||
const char *c = color(WT_STATUS_HEADER, s);
|
const char *c = color(WT_STATUS_HEADER, s);
|
||||||
|
|
||||||
init_revisions(&rev, NULL);
|
init_revisions(&rev, NULL);
|
||||||
DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
|
rev.diffopt.flags.ALLOW_TEXTCONV = 1;
|
||||||
rev.diffopt.ita_invisible_in_index = 1;
|
rev.diffopt.ita_invisible_in_index = 1;
|
||||||
|
|
||||||
memset(&opt, 0, sizeof(opt));
|
memset(&opt, 0, sizeof(opt));
|
||||||
@ -2263,8 +2263,8 @@ int has_unstaged_changes(int ignore_submodules)
|
|||||||
|
|
||||||
init_revisions(&rev_info, NULL);
|
init_revisions(&rev_info, NULL);
|
||||||
if (ignore_submodules)
|
if (ignore_submodules)
|
||||||
DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
|
rev_info.diffopt.flags.IGNORE_SUBMODULES = 1;
|
||||||
DIFF_OPT_SET(&rev_info.diffopt, QUICK);
|
rev_info.diffopt.flags.QUICK = 1;
|
||||||
diff_setup_done(&rev_info.diffopt);
|
diff_setup_done(&rev_info.diffopt);
|
||||||
result = run_diff_files(&rev_info, 0);
|
result = run_diff_files(&rev_info, 0);
|
||||||
return diff_result_code(&rev_info.diffopt, result);
|
return diff_result_code(&rev_info.diffopt, result);
|
||||||
@ -2283,8 +2283,8 @@ int has_uncommitted_changes(int ignore_submodules)
|
|||||||
|
|
||||||
init_revisions(&rev_info, NULL);
|
init_revisions(&rev_info, NULL);
|
||||||
if (ignore_submodules)
|
if (ignore_submodules)
|
||||||
DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
|
rev_info.diffopt.flags.IGNORE_SUBMODULES = 1;
|
||||||
DIFF_OPT_SET(&rev_info.diffopt, QUICK);
|
rev_info.diffopt.flags.QUICK = 1;
|
||||||
add_head_to_pending(&rev_info);
|
add_head_to_pending(&rev_info);
|
||||||
diff_setup_done(&rev_info.diffopt);
|
diff_setup_done(&rev_info.diffopt);
|
||||||
result = run_diff_index(&rev_info, 1);
|
result = run_diff_index(&rev_info, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user