diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-07-06 21:54:47 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-06 21:54:47 +0300 |
commit | 84b889bd035886cb19b1e9a9524dcf8a431836cd (patch) | |
tree | 6f86b3cc3d0aabcaf319e1d51931a7e7559c9369 /apply.c | |
parent | a9cc3b8fc7c904227640aebc9b543bd9a0fb31d2 (diff) | |
parent | 42612e18d2e7c002054b677df791b848b62c1628 (diff) |
Merge branch 'pw/apply-too-large'
"git apply" punts when it is fed too large a patch input; the error
message it gives when it happens has been clarified.
* pw/apply-too-large:
apply: improve error messages when reading patch
Diffstat (limited to 'apply.c')
-rw-r--r-- | apply.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -414,9 +414,10 @@ static void say_patch_name(FILE *output, const char *fmt, struct patch *patch) static int read_patch_file(struct strbuf *sb, int fd) { - if (strbuf_read(sb, fd, 0) < 0 || sb->len >= MAX_APPLY_SIZE) - return error_errno("git apply: failed to read"); - + if (strbuf_read(sb, fd, 0) < 0) + return error_errno(_("failed to read patch")); + else if (sb->len >= MAX_APPLY_SIZE) + return error(_("patch too large")); /* * Make sure that we have some slop in the buffer * so that we can do speculative "memcmp" etc, and |