X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin%2Fapply.c;h=c24dc546d0cc3f223c40c12aa20dc75eff13d4f9;hb=2cb1ff9ac35ff043e377f78e36a57422a6846485;hp=84a8a0b52136c4d1e43ec10f9ef5ed76b7d3c12f;hpb=5ae0f68160a189fafc2cf50b9a35aacc73cf8209;p=git.git diff --git a/builtin/apply.c b/builtin/apply.c index 84a8a0b52..c24dc546d 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -250,9 +250,6 @@ static int fuzzy_matchlines(const char *s1, size_t n1, const char *last2 = s2 + n2 - 1; int result = 0; - if (n1 < 0 || n2 < 0) - return 0; - /* ignore line endings */ while ((*last1 == '\r') || (*last1 == '\n')) last1--; @@ -3590,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) { @@ -3724,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; @@ -3741,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)