All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] Add output_prefix_length to diff_options
@ 2012-03-22 19:27 Lucian Poston
  2012-03-22 19:27 ` [PATCH v2 2/3] Adjust stat width calculations to take --graph output into account Lucian Poston
  2012-03-22 19:27 ` [PATCH v2 3/3] t4052: Test that stat width is adjusted for prefixes Lucian Poston
  0 siblings, 2 replies; 15+ messages in thread
From: Lucian Poston @ 2012-03-22 19:27 UTC (permalink / raw)
  To: git; +Cc: Lucian Poston, Adam Simpkins, Jeff King, Junio C Hamano, Bo Yang

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>
---
 diff.h  |    1 +
 graph.c |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/diff.h b/diff.h
index cb68743..19d762f 100644
--- a/diff.h
+++ b/diff.h
@@ -150,6 +150,7 @@ struct diff_options {
 	diff_format_fn_t format_callback;
 	void *format_callback_data;
 	diff_prefix_fn_t output_prefix;
+	int output_prefix_length;
 	void *output_prefix_data;
 };
 
diff --git a/graph.c b/graph.c
index 7358416..7e0a099 100644
--- a/graph.c
+++ b/graph.c
@@ -194,8 +194,10 @@ static struct strbuf *diff_output_prefix_callback(struct diff_options *opt, void
 	struct git_graph *graph = data;
 	static struct strbuf msgbuf = STRBUF_INIT;
 
+	assert(opt);
 	assert(graph);
 
+	opt->output_prefix_length = graph->width;
 	strbuf_reset(&msgbuf);
 	graph_padding_line(graph, &msgbuf);
 	return &msgbuf;
@@ -245,6 +247,7 @@ struct git_graph *graph_init(struct rev_info *opt)
 	 */
 	opt->diffopt.output_prefix = diff_output_prefix_callback;
 	opt->diffopt.output_prefix_data = graph;
+	opt->diffopt.output_prefix_length = 0;
 
 	return graph;
 }
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-04-16 11:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-22 19:27 [PATCH v2 1/3] Add output_prefix_length to diff_options Lucian Poston
2012-03-22 19:27 ` [PATCH v2 2/3] Adjust stat width calculations to take --graph output into account Lucian Poston
2012-03-22 20:28   ` Zbigniew Jędrzejewski-Szmek
2012-03-23  4:38     ` Lucian Poston
2012-03-22 20:45   ` Junio C Hamano
2012-03-23  4:44     ` Lucian Poston
2012-03-23  5:54   ` Lucian Poston
2012-03-23 10:12     ` Zbigniew Jędrzejewski-Szmek
2012-04-12  7:47       ` Lucian Poston
2012-04-12 10:17         ` Zbigniew Jędrzejewski-Szmek
2012-04-16 11:04           ` Lucian Poston
2012-03-23 18:13     ` Junio C Hamano
2012-04-12  8:35       ` Lucian Poston
2012-03-22 19:27 ` [PATCH v2 3/3] t4052: Test that stat width is adjusted for prefixes Lucian Poston
2012-03-23  5:57   ` Lucian Poston

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.