Commit Briefs


Neels Hofmeyr

add test019 showing max-effort bug


Neels Hofmeyr

debug output fixes

- fix compilation error with DEBUG 1, after moving patience state out of diff_atom, and after renaming diff_data.d to diff_data.root. - add some missing newlines. - also debug "HIT" on a max-effort cut, like when finding a mid snake, which eases finding all the places where boxes get cut.




Stefan Sperling

fix off-by-one access beyond mapped file in diff_data_atomize_text_lines_mmap()

Thread 1 received signal SIGSEGV, Segmentation fault. 0x0000013992a89eca in diff_data_atomize_text_lines_mmap (d=0x13b9b455668) \ at /home/stsp/src/got/got/../lib/diff_atomize_text.c:134 134 if (line_end[0] == '\r' (gdb) p pos $1 = (const uint8_t *) 0x13be402006d "" (gdb) p end $2 = (const uint8_t *) 0x13be4023000 <error: Cannot access memory at \ address 0x13be4023000> (gdb) p end-1 $3 = (const uint8_t *) 0x13be4022fff "" (gdb) p line_end $4 = (const uint8_t *) 0x13be4023000 <error: Cannot access memory at \ address 0x13be4023000>









Stefan Sperling

fix another format string issue in results_test.c

Cast ARRAYLIST_IDX result to unsigned long and use %lu in the format string. Clang 10.0.1 complained as follows: results_test.c:148:9: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] ARRAYLIST_IDX(c, result->chunks), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Stefan Sperling

fix a format string issue in results_test.c

Use explicit casts to long long and use %lld in the format string. Clang 10.0.1 complained as follows: results_test.c:78:9: warning: format specifies type 'int' but the argument has type 'long long' [-Wformat] c->left_start ? c->left_start->pos : -1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Stefan Sperling

fix a format string issue in array test

ARRAYLIST_IDX deals with the head pointer. Explicitly cast to unsigned long and use %lu in the format string. Clang 10.0.1 used to complain as follows: arraylist_test.c:19:2: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] arraylist_test.c:15:24: note: expanded from macro 'dump' printf("[%d] %d\n", ARRAYLIST_IDX(p, list), *p); \ ~~ ^~~~~~~~~~~~~~~~~~~~~~


Stefan Sperling

put functions required for using diff_output_unidiff_chunk() into public API

They will be needed to implement 'got stage -p' and 'got revert -p', etc. Chunks stored in diff_result still need post-processing in order to be displayed as expected by diff_output_unidiff_chunk(). Exposing these functions allows API consumers to implement the same chunk merging loop as used internally by output_unidiff() and output_edscript(). (Perhaps, ideally, the public diff API would provide pre-merged chunks at some point in the future? Then this commit could probably be reverted.) Change return values from bool to int to avoid making stdbool.h a requirement for the public diff API.



Stefan Sperling

use mergesort(3) instead of qsort(3) in patience diff

Fixes test failures on OpenBSD due to unstable results of qsort if two or more elements are equal. Add a compat copy of OpenBSD mergesort(3) for Linux.







Stefan Sperling

print "\ No newline at end of file" message like UNIX diff(1) does

Not adding new tests since this behaviour is covered by tests in Got.