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

Re: [PATCH 7/7] Make --color-words work well with --graph.

From
Thomas Rast <trast@student.ethz.ch>
Date
May 17, 2010, 06:59 UTC
Message-ID
<201005170859.28022.trast@student.ethz.ch>
In-Reply-To
<1273921331-32702-8-git-send-email-struggleyb.nku@gmail.com>
Bo Yang wrote:
Show 17 quoted lines
> @@ -629,20 +640,39 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
>  	} else
>  		plus_begin = plus_end = diff_words->plus.orig[plus_first].end;
>  
> -	if (diff_words->current_plus != plus_begin)
> -		fwrite(diff_words->current_plus,
> -				plus_begin - diff_words->current_plus, 1,
> -				diff_words->file);
> -	if (minus_begin != minus_end)
> -		color_fwrite_lines(diff_words->file,
> +	if (diff_words->current_plus != plus_begin) {
> +		if ((diff_words->current_plus == diff_words->plus.text.ptr &&
> +			diff_words->last_minus == 0) ||
> +			(diff_words->current_plus > diff_words->plus.text.ptr &&
> +			*(diff_words->current_plus - 1) == '\n')) {
> +			fputs(line_prefix, diff_words->opt->file);
> +			print = 1;

Are these border checks needed/the best solution? If so, please can you put an explanation in the commit message?

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Bo YangNext: Thomas Rast
Message 9 of 12 in “Make git log --graph looks better with -p and other diff options”
  1. 0/7 Make git log --graph looks better with -p and other diff optionsBo Yang, May 15, 2010
  2. 1/7 Add a prefix output callback to diff output.Bo Yang, May 15, 2010
  3. 2/7 Change to call the new emit_line.Bo Yang, May 15, 2010
  4. 3/7 Output the graph columns at the end of the commit message.Bo Yang, May 15, 2010
  5. 4/7 diff.c: Output the text graph padding before each diff line.Bo Yang, May 15, 2010
  6. 5/7 Emit a whole line once a time.Bo Yang, May 15, 2010
  7. 6/7 Register a callback for graph output.Bo Yang, May 15, 2010
  8. 7/7 Make --color-words work well with --graph.Bo Yang, May 15, 2010
  9. Thomas RastMay 17, 2010
  10. Thomas RastMay 17, 2010
  11. Thomas RastMay 17, 2010
  12. Thomas RastMay 17, 2010

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.