Commit Briefs

e78a8d73c2 Mark Jamsek

make diff_chunk_type() public and clarify comment

As discussed with stsp, reword an easily misunderstood comment, and move diff_chunk_type() into the public diff API to improve caller efficiency. ok stsp@


1dce05e8f9 Omar Polo

always cast ctype' is*() arguments to unsigned char

Almost all had already an unsigned argument (uint8_t or unsigned char), but cast anyway in case the types are changed in the future. ok stsp@



674563ab13 tj

Don't return errno when fread fails

fread doesn't consistently set errno on failure. - On OpenBSD fread sets errno on possible argument overflows, but this doesn't occur on other platforms. rfread doesn't set errno on EOF or other failures. - ferror does not set errno on failure. Returning errno here is possibly inconsistent. Return EIO here instead. ok stsp@


9f5da0913a 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@


1f690ebe65 Mark Jamsek

sync files from got.git 336075a42a5ae0fa322db734c481d21998e82bb8

ok tb@


35eae7fa6b Mark Jamsek

remove gcc ternary if extension

ok stsp@


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



486215cf28 Neels Hofmeyr

undup code to add result chunks


4861c9da86 Neels Hofmeyr

add sanity assertions around adding result chunks

uncovers errors related to placing minus chunks above already added plus chunks.


10ae3a6560 Neels Hofmeyr

patience debug


f5a254cc6e Neels Hofmeyr

debug fix in diff_data_init_subsection


de7a293922 Neels Hofmeyr

debug init subsection


c16dde50bb Stefan Sperling

allow diff API users to atomize files separately

This is a breaking API change (not that we care about that at this point). This can avoid redundant work spent on atomizing a file multiple times. There are use cases where one particular file must be compared to other files over and over again, such as when blaming file history. The old API gave access to both versions of the file to the atomizer just in case a future atomizer implementation needs this. This can still be achieved by passing a second file via the atomizer's private data pointer.






ad5b3f8555 Neels Hofmeyr

rename diff_atom->d to diff_atom->root, because it always is

The idea was that for each diff box within the files, the atoms would have a backpointer to the current layer of diff_data (indicating the current section), but it is not actually needed to update the backpointer in each atom to the current diff_data. That is why the current code always points atom->d to the root diff_data for the entire file. Clarify by proper name. Constructs like atom->d->root->foo are redundant, just use atom->root->foo.


746d94dfa3 Neels Hofmeyr

diff_main: don't run algo if left or right are empty


acfce337ad Neels Hofmeyr

debug: fix logging first chunk


e5447b812a Neels Hofmeyr

diff_algo_none: cosmetics


9dc0554fce Neels Hofmeyr

fix diff_algo_none() for ending in plus chunk


93f8150ade Neels Hofmeyr

results: also combine chunks coming from temp_chunks