Skip to content

Commit 5e71a84

Browse files
lucianpostongitster
authored andcommitted
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>
1 parent 8c188c7 commit 5e71a84

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

diff.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ struct diff_options {
150150
diff_format_fn_t format_callback;
151151
void *format_callback_data;
152152
diff_prefix_fn_t output_prefix;
153+
int output_prefix_length;
153154
void *output_prefix_data;
154155
};
155156

graph.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ static struct strbuf *diff_output_prefix_callback(struct diff_options *opt, void
194194
struct git_graph *graph = data;
195195
static struct strbuf msgbuf = STRBUF_INIT;
196196

197+
assert(opt);
197198
assert(graph);
198199

200+
opt->output_prefix_length = graph->width;
199201
strbuf_reset(&msgbuf);
200202
graph_padding_line(graph, &msgbuf);
201203
return &msgbuf;
@@ -245,6 +247,7 @@ struct git_graph *graph_init(struct rev_info *opt)
245247
*/
246248
opt->diffopt.output_prefix = diff_output_prefix_callback;
247249
opt->diffopt.output_prefix_data = graph;
250+
opt->diffopt.output_prefix_length = 0;
248251

249252
return graph;
250253
}

0 commit comments

Comments
 (0)