Re: [PATCH] Make git-diff-tree indicate when it flushes
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:27
Junio C Hamano [off-list ref] writes:
Paul Mackerras [off-list ref] writes:quoted
With --always, how do I tell that 65aadb affects apply.c and cc189c doesn't?I am not quite sure exactly what you are trying to achieve, but one trivial way is not giving -s perhaps?
Having said that, I suspect this might be a better way. Whatever you throw at it from stdin that are not a validly looking object name, you will get them back, so you can use your favorite markers.
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c
index cc53b81..7208c48 100644
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c@@ -138,11 +138,15 @@ int cmd_diff_tree(int argc, const char * 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); fflush(stdout); + } else diff_tree_stdin(line); - + } return 0; }