Commit Briefs

tj

fread cannot return -1

fread returns a size_t and can never be -1. fread can signal parameter errors on some platforms, but this isn't portable. Remove this check and break out of the loop when fread returns 0. ok op@


tj

diff: handle missing new lines in trailing context

If there is a missing new line in the context we currently miss it and fail to print the warning. This trips up patch and leads to failures. Catch these cases in for unidiff output and add a test case. ok stsp@


tj

diff: Add API for consumers to check if diff is printable

Programs using the libdiff API they can need to know if the diff contained anything that would be printed, or would be empty. Expose the same check that the output functions do as a function call. ok stsp@




Mark Jamsek

improve accuracy of function prototype in hunk headers

Initial diff by Tom Jones with fixes from stsp. ok stsp@


Stefan Sperling

fix updating of line-offsets output info in plain output mode

reviewed by tom jones



Mark Jamsek

sync files from got.git 336075a42a5ae0fa322db734c481d21998e82bb8

ok tb@


Mark Jamsek

fix build broken in previous commit 35eae7fa6b782ae1

Macro line was wrapped without continuation character. ok tb@


Mark Jamsek

remove gcc ternary if extension

ok stsp@



Mark Jamsek

collect line type metadata when generating diff

Similar to line offsets, create an array of line types (i.e., hunk, context, minus, plus) for each line output in the diff. ok stsp@


Mark Jamsek

sync files from got.git 58e31a80da4f4a9e10eaea148672190f35107a47

ok stsp@



Omar Polo

make diff_atom_hash_update private to diff_atomize_text.c

ok stsp@


Omar Polo

reuse diff_atom_hash_update

ok stsp@


Omar Polo

less chatty regress

ok stsp@


Omar Polo

regress: look for the diff prog also inside obj/

ok stsp@


Omar Polo

adjust the expected output so that regress passes again

Note that test015 is still broken on OpenBSD with base patch(1). ok stsp@


Mark Jamsek

ARRAY_LIST allocation optimisation

Rather than realloc in fixed-sized blocks, use the 1.5 * allocated scheme when growing the array. This produces fewer allocations and up to 3x speedup on large diffs. ok stsp@


Omar Polo

fix accounting for line endings in CRLF files

There are two different subtles error in computing the end of line in diff_data_atomize_text_lines (one in per implementation, _fd and _mmap) that causes the '\n' of the '\r\n' case to be left out the current line. It causes strange bugs when diffing CRLF files, such as printing the "\ No newline at end of file" marker very often and showing the wrong offsets in the hunk headers. ok stsp@


Stefan Sperling

add missing line offset information for unidiff output

We forgot to generate line offset information for lines of the form: "Binary files %s and %s differ" Which is causing scrolling problems in tog's diff view. ok thomas_adam


Stefan Sperling

fix a size_t multiplication overflow in diff_meyrs.c

Found on an OpenBSD armv7 machine running Got regression tests: test_status_shows_no_mods_after_complete_merge Segmentation fault (core dumped) The problematic multiplication is kd_len * kd_len in diff_algo_myers() with kd_len set to 65537. (gdb) p (int)(65537 * 65537) $64 = 131073 (gdb) p (int)(65537 + 65537) $65 = 131074 (gdb) p (unsigned int)(size_t)(-1) $68 = 4294967295 (gdb) p (4294967295 / kd_len) $71 = 65535 Detect such overflow and run the fallback diff algorithm instead.