Commit Briefs

Mark Jamsek

add public APIs to enable chunk byte offset retrieval

Prompted by changes to conflict marker detection in got.git, add chunk offset getters for both left- and right-hand side files. This facilitates more efficient caller diff_result use by directly seeking to a given chunk rather than counting lines. 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@


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"





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.