summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 22669a0)
raw | patch | inline | side by side (parent: 22669a0)
author | Paul Mackerras <paulus@samba.org> | |
Tue, 30 May 2006 02:01:38 +0000 (19:01 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 30 May 2006 02:04:19 +0000 (19:04 -0700) |
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 flush its output and echo back the
input line when it is not a valid-looking object name. Gitk, or
other users of git-diff-tree --stdin, can use a blank line or
any other "marker line" to indicate that git-diff-tree has
processed all the commits on its input up to the echoed back
marker line, and any commits that have not been output do not
match.
[jc: re-done after a couple of back-and-forth discussion on the list.]
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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 flush its output and echo back the
input line when it is not a valid-looking object name. Gitk, or
other users of git-diff-tree --stdin, can use a blank line or
any other "marker line" to indicate that git-diff-tree has
processed all the commits on its input up to the echoed back
marker line, and any commits that have not been output do not
match.
[jc: re-done after a couple of back-and-forth discussion on the list.]
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-diff-tree.c | patch | blob | history |
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c
index cc53b81ac427f27522130e741350b955f4b1f653..58cf65856d1e9e0ab088dab2c051058cf48cb840 100644 (file)
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c
if (opt->diffopt.detect_rename)
opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE |
DIFF_SETUP_USE_CACHE);
- while (fgets(line, sizeof(line), stdin))
- if (line[0] == '\n')
+ while (fgets(line, sizeof(line), stdin)) {
+ unsigned char sha1[20];
+
+ if (get_sha1_hex(line, sha1)) {
+ fputs(line, stdout);
fflush(stdout);
+ }
else
diff_tree_stdin(line);
-
+ }
return 0;
}