SHA256
1
0
forked from pool/patch
patch/diff3-style-merges-refactoring.diff

60 lines
1.7 KiB
Diff

---
patch.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
Index: b/patch.c
===================================================================
--- a/patch.c
+++ b/patch.c
@@ -287,11 +287,7 @@ main (int argc, char **argv)
newwhere = pch_newfirst() + last_offset;
if (skip_rest_of_patch) {
- abort_hunk(!failed, reverse);
- 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,18 +297,10 @@ main (int argc, char **argv)
say ("Patch attempted to create file %s, which already exists.\n",
quotearg (inname));
- abort_hunk(!failed, reverse);
- 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)) {
- abort_hunk (!failed, reverse);
- 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))) {
@@ -327,6 +315,16 @@ main (int argc, char **argv)
say (".\n");
}
}
+ continue;
+
+skip_hunk:
+ abort_hunk(!failed, reverse);
+ 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)