--- patch.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) Index: b/patch.c =================================================================== --- a/patch.c +++ b/patch.c @@ -285,13 +285,7 @@ main (int argc, char **argv) newwhere = pch_newfirst() + last_offset; if (skip_rest_of_patch) { - if (!failed) - reject_header(outname); - abort_hunk(); - failed++; - if (verbosity == VERBOSE) - say ("Hunk #%d ignored at %s.\n", hunk, - format_linenum (numbuf, newwhere)); + goto skip_hunk; } else if (!where || (where == 1 && pch_says_nonexistent (reverse) == 2 @@ -301,22 +295,10 @@ main (int argc, char **argv) say ("Patch attempted to create file %s, which already exists.\n", quotearg (inname)); - if (!failed) - reject_header(outname); - abort_hunk(); - failed++; - if (verbosity != SILENT) - say ("Hunk #%d FAILED at %s.\n", hunk, - format_linenum (numbuf, newwhere)); + goto skip_hunk; } else if (! apply_hunk (&outstate, where)) { - if (!failed) - reject_header(outname); - abort_hunk (); - failed++; - if (verbosity != SILENT) - say ("Hunk #%d FAILED at %s.\n", hunk, - format_linenum (numbuf, newwhere)); + goto skip_hunk; } else { if (verbosity == VERBOSE || (verbosity != SILENT && (fuzz || last_offset))) { @@ -331,6 +313,18 @@ main (int argc, char **argv) say (".\n"); } } + continue; + +skip_hunk: + if (!failed) + reject_header(outname); + abort_hunk (); + failed++; + if (verbosity == VERBOSE || + (!skip_rest_of_patch && verbosity != SILENT)) + say ("Hunk #%d %s at %s.\n", hunk, + skip_rest_of_patch ? "ignored" : "FAILED", + format_linenum (numbuf, newwhere)); } if (!skip_rest_of_patch)