@@ -1337,7 +1337,7 @@ static struct blame_origin *find_origin(struct repository *r,
repo_diff_setup(r, &diff_opts);
diff_opts.flags.recursive = 1;
diff_opts.detect_rename = 0;
- diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diff_opts.output_format = 0;
paths[0] = origin->path;
paths[1] = NULL;
@@ -1420,7 +1420,7 @@ static struct blame_origin *find_rename(struct repository *r,
repo_diff_setup(r, &diff_opts);
diff_opts.flags.recursive = 1;
diff_opts.detect_rename = DIFF_DETECT_RENAME;
- diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diff_opts.output_format = 0;
diff_opts.single_follow = origin->path;
diff_setup_done(&diff_opts);
@@ -2242,7 +2242,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
repo_diff_setup(sb->repo, &diff_opts);
diff_opts.flags.recursive = 1;
- diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diff_opts.output_format = 0;
diff_setup_done(&diff_opts);
@@ -277,7 +277,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
PARSE_OPT_KEEP_DASHDASH);
if (quiet)
- rev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;
+ rev->diffopt.output_format = 0;
argc = setup_revisions(argc, argv, rev, opt);
/* Any arguments at this point are not recognized */
@@ -437,7 +437,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)
repo_diff_setup(the_repository, &diff_opts);
diff_opts.flags.recursive = 1;
diff_opts.detect_rename = 0;
- diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diff_opts.output_format = 0;
diff_setup_done(&diff_opts);
do_diff_cache(orig_tree, &diff_opts);
@@ -1120,7 +1120,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
rev.abbrev = 0;
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
setup_revisions(diff_args.nr, diff_args.v, &rev, &opt);
- rev.diffopt.output_format = DIFF_FORMAT_NO_OUTPUT | DIFF_FORMAT_CALLBACK;
+ rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = submodule_summary_callback;
rev.diffopt.format_callback_data = &list;
@@ -1394,7 +1394,7 @@ static struct combine_diff_path *find_paths_generic(const struct object_id *oid,
int output_format = opt->output_format;
const char *orderfile = opt->orderfile;
- opt->output_format = DIFF_FORMAT_NO_OUTPUT;
+ opt->output_format = 0;
/* tell diff_tree to emit paths in sorted (=tree) order */
opt->orderfile = NULL;
@@ -1408,17 +1408,15 @@ static struct combine_diff_path *find_paths_generic(const struct object_id *oid,
if (i == 0 && stat_opt)
opt->output_format = stat_opt;
else
- opt->output_format = DIFF_FORMAT_NO_OUTPUT;
+ opt->output_format = 0;
diff_tree_oid(&parents->oid[i], oid, "", opt);
diffcore_std(opt);
paths = intersect_paths(paths, i, num_parent,
combined_all_paths);
/* if showing diff, show it in requested order */
- if (opt->output_format != DIFF_FORMAT_NO_OUTPUT &&
- orderfile) {
+ if (opt->output_format && orderfile)
diffcore_order(orderfile);
- }
diff_flush(opt);
}
@@ -1521,7 +1519,7 @@ void diff_tree_combined(const struct object_id *oid,
show_log(rev);
if (rev->verbose_header && opt->output_format &&
- opt->output_format != DIFF_FORMAT_NO_OUTPUT &&
+ opt->output_format &&
!commit_format_is_empty(rev->commit_format))
printf("%s%c", diff_line_prefix(opt),
opt->line_termination);
@@ -4801,8 +4801,7 @@ void diff_setup_done(struct diff_options *options)
if (options->output_format & (DIFF_FORMAT_NAME |
DIFF_FORMAT_NAME_STATUS |
- DIFF_FORMAT_CHECKDIFF |
- DIFF_FORMAT_NO_OUTPUT))
+ DIFF_FORMAT_CHECKDIFF))
options->output_format &= ~(DIFF_FORMAT_RAW |
DIFF_FORMAT_NUMSTAT |
DIFF_FORMAT_DIFFSTAT |
@@ -4846,7 +4845,7 @@ void diff_setup_done(struct diff_options *options)
* exit code in such a case either.
*/
if (options->flags.quick) {
- options->output_format = DIFF_FORMAT_NO_OUTPUT;
+ options->output_format = 0;
options->flags.exit_with_status = 1;
}
@@ -4987,7 +4986,7 @@ static int diff_opt_diff_filter(const struct option *option,
static void enable_patch_output(int *fmt)
{
- *fmt &= ~(DIFF_FORMAT_DEFAULT | DIFF_FORMAT_NO_OUTPUT);
+ *fmt &= ~DIFF_FORMAT_DEFAULT;
*fmt |= DIFF_FORMAT_PATCH;
}
@@ -5492,16 +5491,16 @@ struct option *add_diff_options(const struct option *opts,
OPT_GROUP(N_("Diff output format options")),
OPT_BITOP('p', "patch", &options->output_format,
N_("generate patch"),
- DIFF_FORMAT_PATCH, DIFF_FORMAT_DEFAULT | DIFF_FORMAT_NO_OUTPUT),
+ DIFF_FORMAT_PATCH, DIFF_FORMAT_DEFAULT),
OPT_SET_INT_F('s', "silent", &options->output_format,
N_("suppress diff output"),
- DIFF_FORMAT_NO_OUTPUT, PARSE_OPT_NONEG),
+ 0, PARSE_OPT_NONEG),
OPT_BITOP(0, "no-patch", &options->output_format,
N_("negate --patch"),
- DIFF_FORMAT_NO_OUTPUT, DIFF_FORMAT_PATCH | DIFF_FORMAT_DEFAULT),
+ 0, DIFF_FORMAT_PATCH | DIFF_FORMAT_DEFAULT),
OPT_BITOP('u', NULL, &options->output_format,
N_("generate patch"),
- DIFF_FORMAT_PATCH, DIFF_FORMAT_DEFAULT | DIFF_FORMAT_NO_OUTPUT),
+ DIFF_FORMAT_PATCH, DIFF_FORMAT_DEFAULT),
OPT_CALLBACK_F('U', "unified", options, N_("<n>"),
N_("generate diffs with <n> lines context"),
PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_unified),
@@ -5513,11 +5512,11 @@ struct option *add_diff_options(const struct option *opts,
OPT_BITOP(0, "patch-with-raw", &options->output_format,
N_("synonym for '-p --raw'"),
DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW,
- DIFF_FORMAT_DEFAULT | DIFF_FORMAT_NO_OUTPUT),
+ DIFF_FORMAT_DEFAULT),
OPT_BITOP(0, "patch-with-stat", &options->output_format,
N_("synonym for '-p --stat'"),
DIFF_FORMAT_PATCH | DIFF_FORMAT_DIFFSTAT,
- DIFF_FORMAT_DEFAULT | DIFF_FORMAT_NO_OUTPUT),
+ DIFF_FORMAT_DEFAULT),
OPT_BITOP(0, "numstat", &options->output_format,
N_("machine friendly --stat"),
DIFF_FORMAT_NUMSTAT, DIFF_FORMAT_DEFAULT),
@@ -6648,7 +6647,7 @@ void diff_flush(struct diff_options *options)
separator++;
}
- if (output_format == DIFF_FORMAT_NO_OUTPUT &&
+ if (!output_format &&
options->flags.exit_with_status &&
options->flags.diff_from_contents) {
/*
@@ -94,7 +94,6 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data);
-#define DIFF_FORMAT_NO_OUTPUT 0x0000
#define DIFF_FORMAT_RAW 0x0001
#define DIFF_FORMAT_DIFFSTAT 0x0002
#define DIFF_FORMAT_NUMSTAT 0x0004
@@ -874,7 +874,7 @@ int log_tree_diff_flush(struct rev_info *opt)
if (diff_queue_is_empty(&opt->diffopt)) {
int saved_fmt = opt->diffopt.output_format;
- opt->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;
+ opt->diffopt.output_format = 0;
diff_flush(&opt->diffopt);
opt->diffopt.output_format = saved_fmt;
return 0;
@@ -882,7 +882,7 @@ int log_tree_diff_flush(struct rev_info *opt)
if (opt->loginfo && !opt->no_commit_id) {
show_log(opt);
- if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&
+ if (opt->diffopt.output_format &&
opt->verbose_header &&
opt->commit_format != CMIT_FMT_ONELINE &&
!commit_format_is_empty(opt->commit_format)) {
@@ -3248,7 +3248,7 @@ static int detect_regular_renames(struct merge_options *opt,
diff_opts.rename_limit = 7000;
diff_opts.rename_score = opt->rename_score;
diff_opts.show_rename_progress = opt->show_rename_progress;
- diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diff_opts.output_format = 0;
diff_setup_done(&diff_opts);
diff_queued_diff = renames->pairs[side_index];
@@ -3269,7 +3269,7 @@ static int detect_regular_renames(struct merge_options *opt,
renames->pairs[side_index] = diff_queued_diff;
- diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diff_opts.output_format = 0;
diff_queued_diff.nr = 0;
diff_queued_diff.queue = NULL;
diff_flush(&diff_opts);
@@ -1904,7 +1904,7 @@ static struct diff_queue_struct *get_diffpairs(struct merge_options *opt,
opts.rename_limit = (opt->rename_limit >= 0) ? opt->rename_limit : 7000;
opts.rename_score = opt->rename_score;
opts.show_rename_progress = opt->show_rename_progress;
- opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ opts.output_format = 0;
diff_setup_done(&opts);
diff_tree_oid(&o_tree->object.oid, &tree->object.oid, "", &opts);
diffcore_std(&opts);
@@ -1914,7 +1914,7 @@ static struct diff_queue_struct *get_diffpairs(struct merge_options *opt,
ret = xmalloc(sizeof(*ret));
*ret = diff_queued_diff;
- opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ opts.output_format = 0;
diff_queued_diff.nr = 0;
diff_queued_diff.queue = NULL;
diff_flush(&opts);
@@ -139,7 +139,7 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
repo_diff_setup(o->repo, &opt);
opt.flags.recursive = 1;
- opt.output_format = DIFF_FORMAT_NO_OUTPUT;
+ opt.output_format = 0;
diff_setup_done(&opt);
diff_tree_oid(base, remote, "", &opt);
diffcore_std(&opt);
@@ -201,7 +201,7 @@ static void diff_tree_local(struct notes_merge_options *o,
repo_diff_setup(o->repo, &opt);
opt.flags.recursive = 1;
- opt.output_format = DIFF_FORMAT_NO_OUTPUT;
+ opt.output_format = 0;
diff_setup_done(&opt);
diff_tree_oid(base, local, "", &opt);
diffcore_std(&opt);
@@ -2966,7 +2966,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
}
/* Did the user ask for any diff output? Run the diff! */
- if (revs->diffopt.output_format & ~(DIFF_FORMAT_DEFAULT | DIFF_FORMAT_NO_OUTPUT))
+ if (revs->diffopt.output_format & ~DIFF_FORMAT_DEFAULT)
revs->diff = 1;
/* Pickaxe, diff-filter and rename following need diffs */
@@ -627,7 +627,7 @@ static void try_to_follow_renames(const struct object_id *old_oid,
repo_diff_setup(opt->repo, &diff_opts);
diff_opts.flags.recursive = 1;
diff_opts.flags.find_copies_harder = 1;
- diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diff_opts.output_format = 0;
diff_opts.single_follow = opt->pathspec.items[0].match;
diff_opts.break_opt = opt->break_opt;
diff_opts.rename_score = opt->rename_score;
Instead use an empty output_format (0) as NO_OUTPUT. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- blame.c | 6 +++--- builtin/log.c | 2 +- builtin/stash.c | 2 +- builtin/submodule--helper.c | 2 +- combine-diff.c | 10 ++++------ diff.c | 21 ++++++++++----------- diff.h | 1 - log-tree.c | 4 ++-- merge-ort.c | 4 ++-- merge-recursive.c | 4 ++-- notes-merge.c | 4 ++-- revision.c | 2 +- tree-diff.c | 2 +- 13 files changed, 30 insertions(+), 34 deletions(-)