From cf15095ec52f1e997ec9eef42bdf275d2a68fe66 Mon Sep 17 00:00:00 2001 From: Justin Tobler Date: Fri, 28 Feb 2025 15:33:46 -0600 Subject: builtin/diff-pairs: allow explicit diff queue flush The diffs queued from git-diff-pairs(1) are flushed when stdin is closed. To enable greater flexibility, allow control over when the diff queue is flushed by writing a single NUL byte on stdin between input file pairs. Diff output between flushes is separated by a single NUL byte. Signed-off-by: Justin Tobler Signed-off-by: Junio C Hamano --- Documentation/git-diff-pairs.adoc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/git-diff-pairs.adoc') diff --git a/Documentation/git-diff-pairs.adoc b/Documentation/git-diff-pairs.adoc index e31f2e2fbb..f99fcd1ead 100644 --- a/Documentation/git-diff-pairs.adoc +++ b/Documentation/git-diff-pairs.adoc @@ -17,6 +17,10 @@ in the NUL-terminated raw output format as generated by commands such as `git diff-tree -z -r --raw`. By default, the outputted diffs are computed and shown in the patch format when stdin closes. +A single NUL byte may be written to stdin between raw input lines to compute +file pair diffs up to that point instead of waiting for stdin to close. A NUL +byte is also written to the output to delimit between these batches of diffs. + Usage of this command enables the traditional diff pipeline to be broken up into separate stages where `diff-pairs` acts as the output phase. Other commands, such as `diff-tree`, may serve as a frontend to compute the raw -- cgit v1.3