summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 18b01f4)
raw | patch | inline | side by side (parent: 18b01f4)
author | Paul Mackerras <paulus@samba.org> | |
Thu, 18 May 2006 06:58:51 +0000 (16:58 +1000) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 18 May 2006 07:25:50 +0000 (00:25 -0700) |
Gitk wants to use git-diff-tree as a filter to tell it which ids from
a given list affect a set of files or directories. We don't want to
fork and exec a new git-diff-tree process for each batch of ids, since
there could be a lot of relatively small batches. For example, a
batch could contain as many ids as fit in gitk's headline display
window, i.e. 20 or so, and we would be processing a new batch every
time the user scrolls that window.
The --stdin flag to git-diff-tree is suitable for this, but the main
difficulty is that the output of git-diff-tree gets buffered and
doesn't get sent until the buffer is full.
This provides a way to get git-diff-tree to flush its output buffers.
If a blank line is supplied on git-diff-tree's standard input, it will
flush its output buffers and then accept further input.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
a given list affect a set of files or directories. We don't want to
fork and exec a new git-diff-tree process for each batch of ids, since
there could be a lot of relatively small batches. For example, a
batch could contain as many ids as fit in gitk's headline display
window, i.e. 20 or so, and we would be processing a new batch every
time the user scrolls that window.
The --stdin flag to git-diff-tree is suitable for this, but the main
difficulty is that the output of git-diff-tree gets buffered and
doesn't get sent until the buffer is full.
This provides a way to get git-diff-tree to flush its output buffers.
If a blank line is supplied on git-diff-tree's standard input, it will
flush its output buffers and then accept further input.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff-tree.c | patch | blob | history |
diff --git a/diff-tree.c b/diff-tree.c
index 7207867a74d0869c6a6b839c040321c843ee9c2f..69bb74b3100d598c938fa01f1111deb85abcfac0 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE |
DIFF_SETUP_USE_CACHE);
while (fgets(line, sizeof(line), stdin))
- diff_tree_stdin(line);
+ if (line[0] == '\n')
+ fflush(stdout);
+ else
+ diff_tree_stdin(line);
return 0;
}