From 28452655af988094792483a51d188c58137760cd Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Fri, 3 Aug 2012 14:16:24 +0200 Subject: diff_setup_done(): return void diff_setup_done() has historically returned an error code, but lost the last nonzero return in 943d5b7 (allow diff.renamelimit to be set regardless of -M/-C, 2006-08-09). The callers were in a pretty confused state: some actually checked for the return code, and some did not. Let it return void, and patch all callers to take this into account. This conveniently also gets rid of a handful of different(!) error messages that could never be triggered anyway. Note that the function can still die(). Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- builtin/blame.c | 9 +++------ builtin/checkout.c | 3 +-- builtin/diff.c | 3 +-- builtin/merge.c | 3 +-- 4 files changed, 6 insertions(+), 12 deletions(-) (limited to 'builtin') diff --git a/builtin/blame.c b/builtin/blame.c index 5a67c202f0..c0e26a0b17 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -392,8 +392,7 @@ static struct origin *find_origin(struct scoreboard *sb, paths[1] = NULL; diff_tree_setup_paths(paths, &diff_opts); - if (diff_setup_done(&diff_opts) < 0) - die("diff-setup"); + diff_setup_done(&diff_opts); if (is_null_sha1(origin->commit->object.sha1)) do_diff_cache(parent->tree->object.sha1, &diff_opts); @@ -479,8 +478,7 @@ static struct origin *find_rename(struct scoreboard *sb, diff_opts.single_follow = origin->path; paths[0] = NULL; diff_tree_setup_paths(paths, &diff_opts); - if (diff_setup_done(&diff_opts) < 0) - die("diff-setup"); + diff_setup_done(&diff_opts); if (is_null_sha1(origin->commit->object.sha1)) do_diff_cache(parent->tree->object.sha1, &diff_opts); @@ -1065,8 +1063,7 @@ static int find_copy_in_parent(struct scoreboard *sb, paths[0] = NULL; diff_tree_setup_paths(paths, &diff_opts); - if (diff_setup_done(&diff_opts) < 0) - die("diff-setup"); + diff_setup_done(&diff_opts); /* Try "find copies harder" on new path if requested; * we do not want to use diffcore_rename() actually to diff --git a/builtin/checkout.c b/builtin/checkout.c index a76aa2a6fd..fc581d8bbb 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -315,8 +315,7 @@ static void show_local_changes(struct object *head, struct diff_options *opts) init_revisions(&rev, NULL); rev.diffopt.flags = opts->flags; rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS; - if (diff_setup_done(&rev.diffopt) < 0) - die(_("diff_setup_done failed")); + diff_setup_done(&rev.diffopt); add_pending_object(&rev, head, NULL); run_diff_index(&rev, 0); } diff --git a/builtin/diff.c b/builtin/diff.c index 387afa7568..a2c45dbdc6 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -294,8 +294,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix) argc = setup_revisions(argc, argv, &rev, NULL); if (!rev.diffopt.output_format) { rev.diffopt.output_format = DIFF_FORMAT_PATCH; - if (diff_setup_done(&rev.diffopt) < 0) - die(_("diff_setup_done failed")); + diff_setup_done(&rev.diffopt); } DIFF_OPT_SET(&rev.diffopt, RECURSIVE); diff --git a/builtin/merge.c b/builtin/merge.c index 5126443fdf..99825d63c9 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -402,8 +402,7 @@ static void finish(struct commit *head_commit, opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT; opts.detect_rename = DIFF_DETECT_RENAME; - if (diff_setup_done(&opts) < 0) - die(_("diff_setup_done failed")); + diff_setup_done(&opts); diff_tree_sha1(head, new_head, "", &opts); diffcore_std(&opts); diff_flush(&opts); -- cgit v1.2.3