X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=diff.c;h=2e6965e84b8d87f46081f8b26b9d3fa8554c4049;hb=c7c2bc0ac9e7f077771db53960d4917fda4b27a7;hp=5dd9049c7d354110534b2770fbf6cbc8e74e359e;hpb=f253376dcbadb384d8c8af287c3f9e2271cb5ff4;p=git.git diff --git a/diff.c b/diff.c index 5dd9049c7..2e6965e84 100644 --- a/diff.c +++ b/diff.c @@ -1111,6 +1111,15 @@ static void fn_out_consume(void *priv, char *line, unsigned long len) diff_words_append(line, len, &ecbdata->diff_words->plus); return; + } else if (!prefixcmp(line, "\\ ")) { + /* + * Eat the "no newline at eof" marker as if we + * saw a "+" or "-" line with nothing on it, + * and return without diff_words_flush() to + * defer processing. If this is the end of + * preimage, more "+" lines may come after it. + */ + return; } diff_words_flush(ecbdata); if (ecbdata->diff_words->type == DIFF_WORDS_PORCELAIN) { @@ -1839,20 +1848,20 @@ static unsigned char *deflate_it(char *data, { int bound; unsigned char *deflated; - z_stream stream; + git_zstream stream; memset(&stream, 0, sizeof(stream)); - deflateInit(&stream, zlib_compression_level); - bound = deflateBound(&stream, size); + git_deflate_init(&stream, zlib_compression_level); + bound = git_deflate_bound(&stream, size); deflated = xmalloc(bound); stream.next_out = deflated; stream.avail_out = bound; stream.next_in = (unsigned char *)data; stream.avail_in = size; - while (deflate(&stream, Z_FINISH) == Z_OK) + while (git_deflate(&stream, Z_FINISH) == Z_OK) ; /* nothing */ - deflateEnd(&stream); + git_deflate_end(&stream); *result_size = stream.total_out; return deflated; }