gitk shows an empty line between "Comments" and changed files
- From
- Pavel Roskin <proski@gnu.org>
- Date
- Oct 27, 2005, 17:30 UTC
- Message-ID
- <1130434230.19641.21.camel@dv>
Hello!
gitk is now showing an empty line between "Comments" and changes files. This change was caused by 8b7e5d76e836396a097bb6f61cf930ea872a7bd3 (Make "gitk" work better with dense revlists).
git-diff-tree outputs some SHA1 as the first line if only one tree-ish argument is provided. I don't see any way to suppress that output (see diff-tree.c, line 114).
One solution would be to add an option to git-diff-tree to suppress all headers (let's call it --no-headers).
Or maybe the SHA1 header should never be printed at all? It looks like it's not documented anywhere. It doesn't break the tests.
While debugging the patch, I have found that the p variable is unused in both functions that stopped passing it to git-diff-tree.
Also, gettreediffs function in gitk could use --names-only for git-diff-tree, because it only needs names.
Maybe --names-only and --name-status should suppress the SHA1 header to match their descriptions? Unfortunately, they don't suppress the patch is -p is specified, so "matching the descriptions" would have to take care of it.
P.S. I consider printing the SHA1 header in git-diff-tree an undocumented feature (in other words, a bug).
Proposed patch:
Don't print the SHA1 when only one tree-ish is given to git-diff-tree.
Signed-off-by: Pavel Roskin <proski@gnu.org>
diff --git a/diff-tree.c b/diff-tree.c index 382011a..ac53f48 100644 --- a/diff-tree.c +++ b/diff-tree.c @@ -111,7 +111,6 @@ static int diff_tree_commit(const unsign unsigned char parent[20]; if (get_sha1_hex(buf + offset + 7, parent)) return -1; - header = generate_header(name, sha1_to_hex(parent), buf, size); diff_tree_sha1_top(parent, commit, ""); if (!header && verbose_header) { header_prefix = "\ndiff-tree ";
-- Regards, Pavel Roskin