Commits


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@


sync changes from got.git to implement headers-only mode for plain output


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@


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"


add some API functions which allow access to opaque struct diff_chunk


add diff_chunk_context_load_change() for use with diff_output_unidiff_chunk()


revert db941c24; callers would also need private structs for that idea to work


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.


add a diff output mode which produces simple ed(1) scripts


move headers from include/diff/ to include/; makes things easier for consumers