Add output_prefix_length to diff_options
Add output_prefix_length to diff_options. Initialize the value to 0 and only set it when graph.c:diff_output_prefix_callback() is called. Signed-off-by: Lucian Poston <lucian.poston@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Lucian Poston committed
Apr 16, 2012 at 03:44 UTC
5e71a84a2da8f5dd32c13392854eab4d448c8085
2 files changed
+4
diff.h
+1
@@ -150,6 +150,7 @@ struct diff_options {
150
diff_format_fn_t format_callback;
151
void *format_callback_data;
152
diff_prefix_fn_t output_prefix;
153
+ int output_prefix_length;
154
void *output_prefix_data;
155
};
156
graph.c
+3
@@ -194,8 +194,10 @@ static struct strbuf *diff_output_prefix_callback(struct diff_options *opt, void
194
struct git_graph *graph = data;
195
static struct strbuf msgbuf = STRBUF_INIT;
196
197
+ assert(opt);
198
assert(graph);
199
200
+ opt->output_prefix_length = graph->width;
201
strbuf_reset(&msgbuf);
202
graph_padding_line(graph, &msgbuf);
203
return &msgbuf;
@@ -245,6 +247,7 @@ struct git_graph *graph_init(struct rev_info *opt)
247
*/
248
opt->diffopt.output_prefix = diff_output_prefix_callback;
249
opt->diffopt.output_prefix_data = graph;
250
+ opt->diffopt.output_prefix_length = 0;
251
252
return graph;
253
}