X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fapply.c;h=c24dc546d0cc3f223c40c12aa20dc75eff13d4f9;hb=ab8a78084b7159d99dae2905e1a3ff04c1500a6d;hp=082fe8f3e3e6088adcce4b54ae351c4ec1f03786;hpb=8769e93327f5efc26d179d794a67a5b993cd3693;p=git.git diff --git a/builtin/apply.c b/builtin/apply.c index 082fe8f3e..c24dc546d 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3587,15 +3587,12 @@ static int write_out_one_reject(struct patch *patch) return -1; } -static int write_out_results(struct patch *list, int skipped_patch) +static int write_out_results(struct patch *list) { int phase; int errs = 0; struct patch *l; - if (!list && !skipped_patch) - return error("No changes"); - for (phase = 0; phase < 2; phase++) { l = list; while (l) { @@ -3721,6 +3718,9 @@ static int apply_patch(int fd, const char *filename, int options) offset += nr; } + if (!list && !skipped_patch) + die("unrecognized input"); + if (whitespace_error && (ws_error_action == die_on_ws_error)) apply = 0; @@ -3738,7 +3738,7 @@ static int apply_patch(int fd, const char *filename, int options) !apply_with_reject) exit(1); - if (apply && write_out_results(list, skipped_patch)) + if (apply && write_out_results(list)) exit(1); if (fake_ancestor) @@ -3838,7 +3838,6 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) int i; int errs = 0; int is_not_gitdir = !startup_info->have_repository; - int binary; int force_apply = 0; const char *whitespace_option = NULL; @@ -3857,12 +3856,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) "ignore additions made by the patch"), OPT_BOOLEAN(0, "stat", &diffstat, "instead of applying the patch, output diffstat for the input"), - { OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary, - NULL, "old option, now no-op", - PARSE_OPT_HIDDEN | PARSE_OPT_NOARG }, - { OPTION_BOOLEAN, 0, "binary", &binary, - NULL, "old option, now no-op", - PARSE_OPT_HIDDEN | PARSE_OPT_NOARG }, + OPT_NOOP_NOARG(0, "allow-binary-replacement"), + OPT_NOOP_NOARG(0, "binary"), OPT_BOOLEAN(0, "numstat", &numstat, "shows number of added and deleted lines in decimal notation"), OPT_BOOLEAN(0, "summary", &summary,