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

Re: [PATCH] xdiff: trim common tail with -U0 after diff

From
René Scharfe <l.s.r@web.de>
Date
Jun 23, 2017, 20:39 UTC
Message-ID
<fa350688-1831-f979-b984-3b6d54e32b8c@web.de>
In-Reply-To
<20170623103612.4694-1-git@thequod.de>
Am 23.06.2017 um 12:36 schrieb Daniel Hahler:
Show 49 quoted lines
> When -U0 is used, trim_common_tail should be called after `xdl_diff`, so
> that `--indent-heuristic` (and other diff processing) works as expected.
> 
> It also removes the check for `!(xecfg->flags & XDL_EMIT_FUNCCONTEXT)`
> added in e0876bca4, which does not appear to be necessary anymore after
> moving the trimming down.
> 
> This only adds a test to t4061-diff-indent.sh, but should also have one for
> normal (i.e. non-experimental) diff mode probably?!
> 
> Ref: https://github.com/tomtom/quickfixsigns_vim/issues/74#issue-237900460
> ---
>   t/t4061-diff-indent.sh | 15 +++++++++++++++
>   xdiff-interface.c      |  7 ++++---
>   2 files changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/t/t4061-diff-indent.sh b/t/t4061-diff-indent.sh
> index 2affd7a10..df3151393 100755
> --- a/t/t4061-diff-indent.sh
> +++ b/t/t4061-diff-indent.sh
> @@ -116,6 +116,16 @@ test_expect_success 'prepare' '
>   	 4
>   	EOF
>   
> +	cat <<-\EOF >spaces-compacted-U0-expect &&
> +	diff --git a/spaces.txt b/spaces.txt
> +	--- a/spaces.txt
> +	+++ b/spaces.txt
> +	@@ -4,0 +5,3 @@ a
> +	+b
> +	+a
> +	+
> +	EOF
> +
>   	tr "_" " " <<-\EOF >functions-expect &&
>   	diff --git a/functions.c b/functions.c
>   	--- a/functions.c
> @@ -184,6 +194,11 @@ test_expect_success 'diff: --indent-heuristic with --histogram' '
>   	compare_diff spaces-compacted-expect out-compacted4
>   '
>   
> +test_expect_success 'diff: --indent-heuristic with -U0' '
> +	git diff -U0 --indent-heuristic old new -- spaces.txt >out-compacted5 &&
> +	compare_diff spaces-compacted-U0-expect out-compacted5
> +'
> +
>   test_expect_success 'diff: ugly functions' '
>   	git diff --no-indent-heuristic old new -- functions.c >out &&
>   	compare_diff functions-expect out

The changed test script passes just fine for me even without your change to xdiff-interface.c, which is odd. Do you have another way to demonstrate the unexpected behavior? And can someone replicate the failure?

René
Previous: Junio C HamanoNext: Daniel Hahler
Message 5 of 6 in “xdiff: trim common tail with -U0 after diff”
  1. xdiff: trim common tail with -U0 after diffDaniel Hahler, Jun 23, 2017
  2. Junio C HamanoJun 23, 2017
  3. Stefan BellerJun 23, 2017
  4. Junio C HamanoJun 23, 2017
  5. René ScharfeJun 23, 2017
  6. Daniel HahlerJun 23, 2017

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.