For details on *why* see the commit message of the last commit. The first five patches are slight refactorings to get into good shape, the next patches are funneling all output through emit_line_*. The second last patch introduces an option to buffer up all output before printing, and then the last patch can color up moved lines of code. Any feedback welcome. Thanks, Stefan Stefan Beller (19): diff: readability fix diff: move line ending check into emit_hunk_header diff.c: drop 'nofirst' from emit_line_0 diff.c: factor out diff_flush_patch_all_file_pairs diff.c: emit_line_0 can handle no color setting diff: add emit_line_fmt diff.c: convert fn_out_consume to use emit_line_* diff.c: convert builtin_diff to use emit_line_* diff.c: convert emit_rewrite_diff to use emit_line_* diff.c: convert emit_rewrite_lines to use emit_line_* submodule.c: convert show_submodule_summary to use emit_line_fmt diff.c: convert emit_binary_diff_body to use emit_line_* diff.c: convert show_stats to use emit_line_* diff.c: convert word diffing to use emit_line_* diff.c: convert diff_flush to use emit_line_* diff.c: convert diff_summary to use emit_line_* diff.c: factor out emit_line_ws for coloring whitespaces diff: buffer all output if asked to diff.c: color moved lines differently Documentation/config.txt | 12 +- diff.c | 815 ++++++++++++++++++++++++++++++++++----------- diff.h | 69 +++- submodule.c | 78 ++--- submodule.h | 9 +- t/t4015-diff-whitespace.sh | 229 +++++++++++++ 6 files changed, 960 insertions(+), 252 deletions(-) -- 2.13.0.18.g183880de0a