diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-06-18 11:16:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-06-18 11:16:57 -0700 |
commit | 98ad90fbab90a423ca835956d3121c60db2eb218 (patch) | |
tree | 8e030231c26a2e42ebf366cd58c318a34dd72724 /graph.c | |
parent | e09151281ded5e05ee64e67e5d20529953c23b65 (diff) | |
parent | 4297c0aeb5cc6b9c1c87d770c91e09ac2a837320 (diff) | |
download | git-98ad90fbab90a423ca835956d3121c60db2eb218.tar.gz git-98ad90fbab90a423ca835956d3121c60db2eb218.tar.xz |
Merge branch 'by/diff-graph'
* by/diff-graph:
Make --color-words work well with --graph
graph.c: register a callback for graph output
Emit a whole line in one go
diff.c: Output the text graph padding before each diff line
Output the graph columns at the end of the commit message
Add a prefix output callback to diff output
Conflicts:
diff.c
Diffstat (limited to 'graph.c')
-rw-r--r-- | graph.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -211,6 +211,18 @@ struct git_graph { unsigned short default_column_color; }; +static struct strbuf *diff_output_prefix_callback(struct diff_options *opt, void *data) +{ + struct git_graph *graph = data; + static struct strbuf msgbuf = STRBUF_INIT; + + assert(graph); + + strbuf_reset(&msgbuf); + graph_padding_line(graph, &msgbuf); + return &msgbuf; +} + struct git_graph *graph_init(struct rev_info *opt) { struct git_graph *graph = xmalloc(sizeof(struct git_graph)); @@ -244,6 +256,13 @@ struct git_graph *graph_init(struct rev_info *opt) graph->mapping = xmalloc(sizeof(int) * 2 * graph->column_capacity); graph->new_mapping = xmalloc(sizeof(int) * 2 * graph->column_capacity); + /* + * The diff output prefix callback, with this we can make + * all the diff output to align with the graph lines. + */ + opt->diffopt.output_prefix = diff_output_prefix_callback; + opt->diffopt.output_prefix_data = graph; + return graph; } |