[PATCH] Make git-diff-tree indicate when it flushes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are times when gitk needs to know that the commits it has sent
to git-diff-tree --stdin did not match, and it needs to know in a
timely fashion even if none of them match.  At the moment,
git-diff-tree outputs nothing for non-matching commits, so it is
impossible for gitk to distinguish between git-diff-tree being slow
and git-diff-tree saying no.

This makes git-diff-tree output a blank line in response to a blank
line in its input (which already causes git-diff-tree to flush its
output buffers).  Gitk, or other users of git-diff-tree --stdin, can
use the blank line to indicate that git-diff-tree has processed all
the commits on its input up to the input blank line, and any commits
that have not been output do not match.

Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>
---
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c
index cc53b81..dbe5737 100644
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c
@@ -139,9 +139,10 @@ int cmd_diff_tree(int argc, const char *
 		opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE |
 				       DIFF_SETUP_USE_CACHE);
 	while (fgets(line, sizeof(line), stdin))
-		if (line[0] == '\n')
+		if (line[0] == '\n') {
+			putchar('\n');
 			fflush(stdout);
-		else
+		} else
 			diff_tree_stdin(line);
 
 	return 0;
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]