Commit Briefs

7a38b3a33f Mark Jamsek

fix build broken in previous commit 35eae7fa6b782ae1

Macro line was wrapped without continuation character. ok tb@


35eae7fa6b Mark Jamsek

remove gcc ternary if extension

ok stsp@


b1aa94aab8 Stefan Sperling

add support for classic diff(1) output; patch by Tom Jones


9343b92549 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@


e450035c85 Mark Jamsek

sync files from got.git 58e31a80da4f4a9e10eaea148672190f35107a47

ok stsp@



f400825bc6 Omar Polo

make diff_atom_hash_update private to diff_atomize_text.c

ok stsp@


cd9ef01a44 Omar Polo

reuse diff_atom_hash_update

ok stsp@


b9efd927c0 Omar Polo

less chatty regress

ok stsp@


9bf4a819c3 Omar Polo

regress: look for the diff prog also inside obj/

ok stsp@


405e89a6da 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@


3a15e1807a 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@


ed9312f04b 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@


b72f51ffc3 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


f1dbec24f9 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.



9879b82a58 Stefan Sperling

avoid writing just one character at a time in diff_output_lines()

With input from ori@ and millert@


b3fd1fa284 Stefan Sperling

fix performance issues in the search for function prototypes

with + ok naddy


86b603da30 Neels Hofmeyr

patience: do not swallow identical neighbors

This does not make much sense, because if common-unique lines swallow their neighboring ones, they count less, and another bad, shorter sequence may gain more weight than a very long sequence that was combined to just one common-unique chunk. It also much simplifies the code and avoids bugs we had to implement complex fixes for before.


df581e4b0e Stefan Sperling

set diff box recursion limit to UINT_MAX by default

In practice, recursion is already limited by our Myers max-effort cut and this heuristic should generally provide a better split than a limit on the number of diff boxes. A recursion limit is only required for diff configs that do not include the Myers algorithm, which we currently don't have. Discussed with Neels


60c6aae16f Stefan Sperling

set a minimum myers effort limit to avoid an early short-cut on small files

discussed with Neels


e4c510c1d8 Stefan Sperling

allow for telling the difference between empty and non-existent files

Adjust labels used in diff output accordingly; non-existent files should have the label "/dev/null"




fe6d58fb52 Christian Weisgerber

add a missing include for uint8_t and switch from <inttypes.h> to <stdint.h>

ok millert stsp