From 660e113ce11840f4bc4028bff89889e6122fe89a Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Wed, 31 Aug 2016 16:27:20 -0700 Subject: graph: add support for --line-prefix on all graph-aware output Add an extension to git-diff and git-log (and any other graph-aware displayable output) such that "--line-prefix=" will print the additional line-prefix on every line of output. To make this work, we have to fix a few bugs in the graph API that force graph_show_commit_msg to be used only when you have a valid graph. Additionally, we extend the default_diff_output_prefix handler to work even when no graph is enabled. This is somewhat of a hack on top of the graph API, but I think it should be acceptable here. This will be used by a future extension of submodule display which displays the submodule diff as the actual diff between the pre and post commit in the submodule project. Add some tests for both git-log and git-diff to ensure that the prefix is honored correctly. Signed-off-by: Jacob Keller Signed-off-by: Junio C Hamano --- log-tree.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'log-tree.c') diff --git a/log-tree.c b/log-tree.c index bfb735c84..8c2415747 100644 --- a/log-tree.c +++ b/log-tree.c @@ -715,10 +715,7 @@ void show_log(struct rev_info *opt) else opt->missing_newline = 0; - if (opt->graph) - graph_show_commit_msg(opt->graph, &msgbuf); - else - fwrite(msgbuf.buf, sizeof(char), msgbuf.len, opt->diffopt.file); + graph_show_commit_msg(opt->graph, opt->diffopt.file, &msgbuf); if (opt->use_terminator && !commit_format_is_empty(opt->commit_format)) { if (!opt->missing_newline) graph_show_padding(opt->graph); -- cgit v1.2.1