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>
switch (st.st_mode & S_IFMT) {
case S_IFREG:
- if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
+ if (opt->flags.ALLOW_TEXTCONV &&
textconv_object(read_from, mode, &null_oid, 0, &buf_ptr, &buf_len))
strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1);
else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size)
unsigned long file_size;
(*num_read_blob)++;
- if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
+ if (opt->flags.ALLOW_TEXTCONV &&
textconv_object(o->path, o->mode, &o->blob_oid, 1, &file->ptr, &file_size))
;
else
&target->commit->tree->object.oid,
"", &diff_opts);
- if (!DIFF_OPT_TST(&diff_opts, FIND_COPIES_HARDER))
+ if (!diff_opts.flags.FIND_COPIES_HARDER)
diffcore_std(&diff_opts);
do {
if (fill_blob_sha1_and_mode(o))
die(_("no such path %s in %s"), path, final_commit_name);
- if (DIFF_OPT_TST(&sb->revs->diffopt, ALLOW_TEXTCONV) &&
+ if (sb->revs->diffopt.flags.ALLOW_TEXTCONV &&
textconv_object(path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
&sb->final_buf_size))
;
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)
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);
}
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);
!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);
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)
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);
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,
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);
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)
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];
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);
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 */
* 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 ||
int changed = ce_match_stat(ce, st, ce_option);
if (S_ISGITLINK(ce->ce_mode)) {
struct diff_flags orig_flags = diffopt->flags;
- if (!DIFF_OPT_TST(diffopt, OVERRIDE_SUBMODULE_CONFIG))
+ if (!diffopt->flags.OVERRIDE_SUBMODULE_CONFIG)
set_diffopt_flags_from_submodule_config(diffopt, ce->name);
- if (DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES))
+ if (diffopt->flags.IGNORE_SUBMODULES)
changed = 0;
- else if (!DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)
- && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES)))
- *dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));
+ else if (!diffopt->flags.IGNORE_DIRTY_SUBMODULES &&
+ (!changed || diffopt->flags.DIRTY_SUBMODULES))
+ *dirty_submodule = is_submodule_modified(ce->name,
+ diffopt->flags.IGNORE_UNTRACKED_IN_SUBMODULES);
diffopt->flags = orig_flags;
}
return changed;
if (!changed && !dirty_submodule) {
ce_mark_uptodate(ce);
- if (!DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
+ if (!revs->diffopt.flags.FIND_COPIES_HARDER)
continue;
}
oldmode = ce->ce_mode;
oldmode = old->ce_mode;
if (mode == oldmode && !oidcmp(oid, &old->oid) && !dirty_submodule &&
- !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
+ !revs->diffopt.flags.FIND_COPIES_HARDER)
return 0;
diff_change(&revs->diffopt, oldmode, mode,
opts.head_idx = 1;
opts.index_only = cached;
opts.diff_index_cached = (cached &&
- !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER));
+ !revs->diffopt.flags.FIND_COPIES_HARDER);
opts.merge = 1;
opts.fn = oneway_diff;
opts.unpack_data = revs;
rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
run_diff_index(&rev, 1);
object_array_clear(&rev.pending);
- return (DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0);
+ return (rev.diffopt.flags.HAS_CHANGES != 0);
}
} else {
struct diff_filespec *d1, *d2;
- if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
+ if (o->flags.REVERSE_DIFF) {
SWAP(mode1, mode2);
SWAP(name1, name2);
}
struct emit_callback ecbdata;
struct strbuf out = STRBUF_INIT;
- if (diff_mnemonic_prefix && DIFF_OPT_TST(o, REVERSE_DIFF)) {
+ if (diff_mnemonic_prefix && o->flags.REVERSE_DIFF) {
a_prefix = o->b_prefix;
b_prefix = o->a_prefix;
} else {
dir.alloc = 0;
dir.nr = 0;
dir.permille = options->dirstat_permille;
- dir.cumulative = DIFF_OPT_TST(options, DIRSTAT_CUMULATIVE);
+ dir.cumulative = options->flags.DIRSTAT_CUMULATIVE;
changed = 0;
for (i = 0; i < q->nr; i++) {
goto found_damage;
}
- if (DIFF_OPT_TST(options, DIRSTAT_BY_FILE)) {
+ if (options->flags.DIRSTAT_BY_FILE) {
/*
* In --dirstat-by-file mode, we don't really need to
* look at the actual file contents at all.
dir.alloc = 0;
dir.nr = 0;
dir.permille = options->dirstat_permille;
- dir.cumulative = DIFF_OPT_TST(options, DIRSTAT_CUMULATIVE);
+ dir.cumulative = options->flags.DIRSTAT_CUMULATIVE;
changed = 0;
for (i = 0; i < data->nr; i++) {
const char *line_prefix = diff_line_prefix(o);
diff_set_mnemonic_prefix(o, "a/", "b/");
- if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
+ if (o->flags.REVERSE_DIFF) {
a_prefix = o->b_prefix;
b_prefix = o->a_prefix;
} else {
return;
}
- if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
+ if (o->flags.ALLOW_TEXTCONV) {
textconv_one = get_textconv(one);
textconv_two = get_textconv(two);
}
header.len, 0);
strbuf_reset(&header);
goto free_ab_and_return;
- } else if (!DIFF_OPT_TST(o, TEXT) &&
+ } else if (!o->flags.TEXT &&
( (!textconv_one && diff_filespec_is_binary(one)) ||
(!textconv_two && diff_filespec_is_binary(two)) )) {
struct strbuf sb = STRBUF_INIT;
if (!one->data && !two->data &&
S_ISREG(one->mode) && S_ISREG(two->mode) &&
- !DIFF_OPT_TST(o, BINARY)) {
+ !o->flags.BINARY) {
if (!oidcmp(&one->oid, &two->oid)) {
if (must_show_header)
emit_diff_symbol(o, DIFF_SYMBOL_HEADER,
}
emit_diff_symbol(o, DIFF_SYMBOL_HEADER, header.buf, header.len, 0);
strbuf_reset(&header);
- if (DIFF_OPT_TST(o, BINARY))
+ if (o->flags.BINARY)
emit_binary_diff(o, &mf1, &mf2);
else {
strbuf_addf(&sb, "%sBinary files %s and %s differ\n",
xecfg.ctxlen = o->context;
xecfg.interhunkctxlen = o->interhunkcontext;
xecfg.flags = XDL_EMIT_FUNCNAMES;
- if (DIFF_OPT_TST(o, FUNCCONTEXT))
+ if (o->flags.FUNCCONTEXT)
xecfg.flags |= XDL_EMIT_FUNCCONTEXT;
if (pe)
xdiff_set_find_func(&xecfg, pe->pattern, pe->cflags);
*must_show_header = 0;
}
if (one && two && oidcmp(&one->oid, &two->oid)) {
- int abbrev = DIFF_OPT_TST(o, FULL_INDEX) ? 40 : DEFAULT_ABBREV;
+ int abbrev = o->flags.FULL_INDEX ? 40 : DEFAULT_ABBREV;
- if (DIFF_OPT_TST(o, BINARY)) {
+ if (o->flags.BINARY) {
mmfile_t mf;
if ((!fill_mmfile(&mf, one) && diff_filespec_is_binary(one)) ||
(!fill_mmfile(&mf, two) && diff_filespec_is_binary(two)))
int must_show_header = 0;
- if (DIFF_OPT_TST(o, ALLOW_EXTERNAL)) {
+ if (o->flags.ALLOW_EXTERNAL) {
struct userdiff_driver *drv = userdiff_find_by_path(attr_path);
if (drv && drv->external)
pgm = drv->external;
if (o->prefix_length)
strip_prefix(o->prefix_length, &name, &other);
- if (!DIFF_OPT_TST(o, ALLOW_EXTERNAL))
+ if (!o->flags.ALLOW_EXTERNAL)
pgm = NULL;
if (DIFF_PAIR_UNMERGED(p)) {
else
DIFF_OPT_CLR(options, DIFF_FROM_CONTENTS);
- if (DIFF_OPT_TST(options, FIND_COPIES_HARDER))
+ if (options->flags.FIND_COPIES_HARDER)
options->detect_rename = DIFF_DETECT_COPY;
- if (!DIFF_OPT_TST(options, RELATIVE_NAME))
+ if (!options->flags.RELATIVE_NAME)
options->prefix = NULL;
if (options->prefix)
options->prefix_length = strlen(options->prefix);
* to have found. It does not make sense not to return with
* exit code in such a case either.
*/
- if (DIFF_OPT_TST(options, QUICK)) {
+ if (options->flags.QUICK) {
options->output_format = DIFF_FORMAT_NO_OUTPUT;
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
}
options->diff_path_counter = 0;
- if (DIFF_OPT_TST(options, FOLLOW_RENAMES) && options->pathspec.nr != 1)
+ if (options->flags.FOLLOW_RENAMES && options->pathspec.nr != 1)
die(_("--follow requires exactly one pathspec"));
if (!options->use_color || external_diff())
separator++;
}
- if (output_format & DIFF_FORMAT_DIRSTAT && DIFF_OPT_TST(options, DIRSTAT_BY_LINE))
+ if (output_format & DIFF_FORMAT_DIRSTAT && options->flags.DIRSTAT_BY_LINE)
dirstat_by_line = 1;
if (output_format & (DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT|DIFF_FORMAT_NUMSTAT) ||
}
if (output_format & DIFF_FORMAT_NO_OUTPUT &&
- DIFF_OPT_TST(options, EXIT_WITH_STATUS) &&
- DIFF_OPT_TST(options, DIFF_FROM_CONTENTS)) {
+ options->flags.EXIT_WITH_STATUS &&
+ options->flags.DIFF_FROM_CONTENTS) {
/*
* run diff_flush_patch for the exit status. setting
* options->file to /dev/null should be safe, because we
* diff_addremove/diff_change does not set the bit when
* DIFF_FROM_CONTENTS is in effect (e.g. with -w).
*/
- if (DIFF_OPT_TST(options, DIFF_FROM_CONTENTS)) {
+ if (options->flags.DIFF_FROM_CONTENTS) {
if (options->found_changes)
DIFF_OPT_SET(options, HAS_CHANGES);
else
* to determine how many paths were dirty only
* due to stat info mismatch.
*/
- if (!DIFF_OPT_TST(diffopt, NO_INDEX))
+ if (!diffopt->flags.NO_INDEX)
diffopt->skip_stat_unmatch++;
diff_free_filepair(p);
}
diff_resolve_rename_copy();
diffcore_apply_filter(options);
- if (diff_queued_diff.nr && !DIFF_OPT_TST(options, DIFF_FROM_CONTENTS))
+ if (diff_queued_diff.nr && !options->flags.DIFF_FROM_CONTENTS)
DIFF_OPT_SET(options, HAS_CHANGES);
else
DIFF_OPT_CLR(options, HAS_CHANGES);
diff_warn_rename_limit("diff.renameLimit",
opt->needed_rename_limit,
opt->degraded_cc_to_c);
- if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
+ if (!opt->flags.EXIT_WITH_STATUS &&
!(opt->output_format & DIFF_FORMAT_CHECKDIFF))
return status;
- if (DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
- DIFF_OPT_TST(opt, HAS_CHANGES))
+ if (opt->flags.EXIT_WITH_STATUS &&
+ opt->flags.HAS_CHANGES)
result |= 01;
if ((opt->output_format & DIFF_FORMAT_CHECKDIFF) &&
- DIFF_OPT_TST(opt, CHECK_FAILED))
+ opt->flags.CHECK_FAILED)
result |= 02;
return result;
}
int diff_can_quit_early(struct diff_options *opt)
{
- return (DIFF_OPT_TST(opt, QUICK) &&
+ return (opt->flags.QUICK &&
!opt->filter &&
- DIFF_OPT_TST(opt, HAS_CHANGES));
+ opt->flags.HAS_CHANGES);
}
/*
{
int ignored = 0;
struct diff_flags orig_flags = options->flags;
- if (!DIFF_OPT_TST(options, OVERRIDE_SUBMODULE_CONFIG))
+ if (!options->flags.OVERRIDE_SUBMODULE_CONFIG)
set_diffopt_flags_from_submodule_config(options, path);
- if (DIFF_OPT_TST(options, IGNORE_SUBMODULES))
+ if (options->flags.IGNORE_SUBMODULES)
ignored = 1;
options->flags = orig_flags;
return ignored;
* Before the final output happens, they are pruned after
* merged into rename/copy pairs as appropriate.
*/
- if (DIFF_OPT_TST(options, REVERSE_DIFF))
+ if (options->flags.REVERSE_DIFF)
addremove = (addremove == '+' ? '-' :
addremove == '-' ? '+' : addremove);
}
diff_queue(&diff_queued_diff, one, two);
- if (!DIFF_OPT_TST(options, DIFF_FROM_CONTENTS))
+ if (!options->flags.DIFF_FROM_CONTENTS)
DIFF_OPT_SET(options, HAS_CHANGES);
}
is_submodule_ignored(concatpath, options))
return;
- if (DIFF_OPT_TST(options, REVERSE_DIFF)) {
+ if (options->flags.REVERSE_DIFF) {
SWAP(old_mode, new_mode);
SWAP(old_oid, new_oid);
SWAP(old_oid_valid, new_oid_valid);
two->dirty_submodule = new_dirty_submodule;
p = diff_queue(&diff_queued_diff, one, two);
- if (DIFF_OPT_TST(options, DIFF_FROM_CONTENTS))
+ if (options->flags.DIFF_FROM_CONTENTS)
return;
- if (DIFF_OPT_TST(options, QUICK) && options->skip_stat_unmatch &&
+ if (options->flags.QUICK && options->skip_stat_unmatch &&
!diff_filespec_check_stat_unmatch(p))
return;
* and because it is easy to find people oneline advising "git diff
* --exit-code" in hooks and other scripts, we do not do so.
*/
- if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
+ if (!opt->flags.EXIT_WITH_STATUS &&
check_pager_config("diff") != 0)
setup_pager();
}
tmp_a[i] |= tmp_b[i];
}
-#define DIFF_OPT_TST(opts, flag) ((opts)->flags.flag)
#define DIFF_OPT_SET(opts, flag) ((opts)->flags.flag = 1)
#define DIFF_OPT_CLR(opts, flag) ((opts)->flags.flag = 0)
if (!DIFF_FILE_VALID(p->one) && !DIFF_FILE_VALID(p->two))
return 0;
- if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
+ if (o->flags.ALLOW_TEXTCONV) {
textconv_one = get_textconv(p->one);
textconv_two = get_textconv(p->two);
}
if (opts & (DIFF_PICKAXE_REGEX | DIFF_PICKAXE_KIND_G)) {
int cflags = REG_EXTENDED | REG_NEWLINE;
- if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE))
+ if (o->flags.PICKAXE_IGNORE_CASE)
cflags |= REG_ICASE;
regcomp_or_die(®ex, needle, cflags);
regexp = ®ex;
- } else if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE) &&
+ } else if (o->flags.PICKAXE_IGNORE_CASE &&
has_non_ascii(needle)) {
struct strbuf sb = STRBUF_INIT;
int cflags = REG_NEWLINE | REG_ICASE;
strbuf_release(&sb);
regexp = ®ex;
} else {
- kws = kwsalloc(DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE)
+ kws = kwsalloc(o->flags.PICKAXE_IGNORE_CASE
? tolower_trans_tbl : NULL);
kwsincr(kws, needle, strlen(needle));
kwsprep(kws);
num_src > num_create ? num_src : num_create;
/* Are we running under -C -C? */
- if (!DIFF_OPT_TST(options, FIND_COPIES_HARDER))
+ if (!options->flags.FIND_COPIES_HARDER)
return 1;
/* Would we bust the limit if we were running under -C? */
else if (options->single_follow &&
strcmp(options->single_follow, p->two->path))
continue; /* not interested */
- else if (!DIFF_OPT_TST(options, RENAME_EMPTY) &&
+ else if (!options->flags.RENAME_EMPTY &&
is_empty_blob_oid(&p->two->oid))
continue;
else if (add_rename_dst(p->two) < 0) {
goto cleanup;
}
}
- else if (!DIFF_OPT_TST(options, RENAME_EMPTY) &&
+ else if (!options->flags.RENAME_EMPTY &&
is_empty_blob_oid(&p->one->oid))
continue;
else if (!DIFF_PAIR_UNMERGED(p) && !DIFF_FILE_VALID(p->two)) {
struct commit_list *parents;
struct object_id *oid;
- if (!opt->diff && !DIFF_OPT_TST(&opt->diffopt, EXIT_WITH_STATUS))
+ if (!opt->diff && !opt->diffopt.flags.EXIT_WITH_STATUS)
return 0;
parse_commit_or_die(commit);
/* Pickaxe, diff-filter and rename following need diffs */
if (revs->diffopt.pickaxe ||
revs->diffopt.filter ||
- DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))
+ revs->diffopt.flags.FOLLOW_RENAMES)
revs->diff = 1;
if (revs->topo_order)
if (revs->prune_data.nr) {
copy_pathspec(&revs->pruning.pathspec, &revs->prune_data);
/* Can't prune commits with rename following: the paths change.. */
- if (!DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))
+ if (!revs->diffopt.flags.FOLLOW_RENAMES)
revs->prune = 1;
if (!revs->full_diff)
copy_pathspec(&revs->diffopt.pathspec,
argv_array_pushf(&cp.args, "--color=%s", want_color(o->use_color) ?
"always" : "never");
- if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
+ if (o->flags.REVERSE_DIFF) {
argv_array_pushf(&cp.args, "--src-prefix=%s%s/",
o->b_prefix, path);
argv_array_pushf(&cp.args, "--dst-prefix=%s%s/",
mode = 0;
}
- if (DIFF_OPT_TST(opt, RECURSIVE) && isdir) {
+ if (opt->flags.RECURSIVE && isdir) {
recurse = 1;
- emitthis = DIFF_OPT_TST(opt, TREE_IN_RECURSIVE);
+ emitthis = opt->flags.TREE_IN_RECURSIVE;
}
if (emitthis) {
ttree = fill_tree_descriptor(&t, oid);
/* Enable recursion indefinitely */
- opt->pathspec.recursive = DIFF_OPT_TST(opt, RECURSIVE);
+ opt->pathspec.recursive = opt->flags.RECURSIVE;
for (;;) {
int imin, cmp;
/* t = p[imin] */
if (cmp == 0) {
/* are either pi > p[imin] or diff(t,pi) != ø ? */
- if (!DIFF_OPT_TST(opt, FIND_COPIES_HARDER)) {
+ if (!opt->flags.FIND_COPIES_HARDER) {
for (i = 0; i < nparent; ++i) {
/* p[i] > p[imin] */
if (tp[i].entry.mode & S_IFXMIN_NEQ)
/* t > p[imin] */
else {
/* ∀i pi=p[imin] -> D += "-p[imin]" */
- if (!DIFF_OPT_TST(opt, FIND_COPIES_HARDER)) {
+ if (!opt->flags.FIND_COPIES_HARDER) {
for (i = 0; i < nparent; ++i)
if (tp[i].entry.mode & S_IFXMIN_NEQ)
goto skip_emit_tp;
strbuf_addstr(&base, base_str);
retval = ll_diff_tree_oid(old_oid, new_oid, &base, opt);
- if (!*base_str && DIFF_OPT_TST(opt, FOLLOW_RENAMES) && diff_might_be_rename())
+ if (!*base_str && opt->flags.FOLLOW_RENAMES && diff_might_be_rename())
try_to_follow_renames(old_oid, new_oid, &base, opt);
strbuf_release(&base);