git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/7] Add output_prefix_length to diff_options

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 16, 2012, 18:48 UTC
Message-ID
<7vsjg3tsvv.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1334573095-32286-3-git-send-email-lucian.poston@gmail.com>
Lucian Poston <lucian.poston@gmail.com> writes:
Show 8 quoted lines
> 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(-)

This patch is a no-op, as nobody pays attention to the value this field contains. I think it is better to squash this with 3/7 where you introduce the only user of this field.

Also when that happens, you would need to adjust the test vector, which may mean that you need to squash the result with 4/7 as well.

Show 35 quoted lines
> 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;
>  }
Previous: Lucian PostonNext: Lucian Poston
Message 4 of 15 in “diff stat calculation adjustments”
  1. 0/7 diff stat calculation adjustmentsLucian Poston, Apr 16, 2012
  2. 1/7 t4052: test --stat output with --graphLucian Poston, Apr 16, 2012
  3. 2/7 Add output_prefix_length to diff_optionsLucian Poston, Apr 16, 2012
  4. Junio C HamanoApr 16, 2012
  5. Lucian PostonApr 18, 2012
  6. 3/7 Adjust stat width calculations to take --graph output into accountLucian Poston, Apr 16, 2012
  7. 4/7 t4052: Adjust --graph --stat output for prefixesLucian Poston, Apr 16, 2012
  8. Junio C HamanoApr 16, 2012
  9. Lucian PostonApr 18, 2012
  10. 5/7 t4052: Add tests to illustrate issues with restrictive COLUMNSLucian Poston, Apr 16, 2012
  11. Junio C HamanoApr 16, 2012
  12. Lucian PostonApr 18, 2012
  13. 6/7 Prevent graph_width of diff stat from falling below minLucian Poston, Apr 16, 2012
  14. 7/7 t4052: Adjust --stat output for minimum graph_widthLucian Poston, Apr 16, 2012
  15. Junio C HamanoApr 16, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.