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

Re: [PATCH 3/5] t4015: test the output of "diff --color-moved -b"

From
Stefan Beller <sbeller@google.com>
Date
Oct 19, 2017, 21:03 UTC
Message-ID
<CAGZ79kaszx26d8D0UrEj948Fam5b41hQWXcpC0V-5Rrom6M15w@mail.gmail.com>
In-Reply-To
<20171019202630.plnm6g4x3cuggxoj@sigill.intra.peff.net>
On Thu, Oct 19, 2017 at 1:26 PM, Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> Commit fa5ba2c1dd (diff: fix infinite loop with
> --color-moved --ignore-space-change, 2017-10-12) added a
> test to make sure that "--color-moved -b" doesn't run
> forever, but the test in question doesn't actually have any
> moved lines in it.
>
> Let's scrap that test and add a variant of the existing
> "--color-moved -w" test, but this time we'll check that we
> find the move with whitespace changes, but not arbitrary
> whitespace additions.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> +
> +       git diff HEAD --no-renames --color-moved --color |
> +               grep -v "index" |
> +               test_decode_color >actual &&

The -v index grep makes it future proof (for a new hash)! I like that. What I do not like is the pipe at the end of git-diff as we certainly want to inspect the return code (or for a segfault ;)

> +       git diff HEAD --no-renames -b --color-moved --color |
> +               grep -v "index" |
> +               test_decode_color >actual &&

Do we need (or rather want) to give --color additionally, instead of having --color-moved imply it? I guess this is extra carefulness from the "color always" series?

Show 15 quoted lines
>  test_expect_success 'clean up whitespace-test colors' '
>         git config --unset color.diff.oldMoved &&
>         git config --unset color.diff.newMoved
> @@ -1549,13 +1613,4 @@ test_expect_success 'move detection with submodules' '
>         test_cmp expect decoded_actual
>  '
>
> -test_expect_success 'move detection with whitespace changes' '
> -       test_when_finished "git reset --hard" &&
> -       test_seq 10 >test &&
> -       git add test &&
> -       sed s/3/42/ <test >test.tmp &&
> -       mv test.tmp test &&
> -       git -c diff.colormoved diff --ignore-space-change -- test
> -'
Ok, this is covered above in testing for the unchanged lines (1-5)
Previous: Jeff KingNext: Jeff King
Message 22 of 34 in “Out of memory with diff.colormoved enabled”
  1. Orgad ShanehOct 12, 2017
  2. Jeff KingOct 12, 2017
  3. Stefan BellerOct 12, 2017
  4. diff.c: increment buffer pointer in all code pathStefan Beller, Oct 12, 2017
  5. Jeff KingOct 13, 2017
  6. Jeff KingOct 13, 2017
  7. Stefan BellerOct 13, 2017
  8. Jeff KingOct 19, 2017
  9. Jeff KingOct 19, 2017
  10. Junio C HamanoOct 19, 2017
  11. Junio C HamanoOct 19, 2017
  12. Jeff KingOct 19, 2017
  13. Jeff KingOct 19, 2017
  14. Stefan BellerOct 19, 2017
  15. 0/5 fix "diff --color-moved --ignore-space-at-eol"Jeff King, Oct 19, 2017
  16. 1/5 t4015: refactor --color-moved whitespace testJeff King, Oct 19, 2017
  17. Stefan BellerOct 19, 2017
  18. Jeff KingOct 19, 2017
  19. 2/5 t4015: check "negative" case for "-w --color-moved"Jeff King, Oct 19, 2017
  20. Stefan BellerOct 19, 2017
  21. 3/5 t4015: test the output of "diff --color-moved -b"Jeff King, Oct 19, 2017
  22. Stefan BellerOct 19, 2017
  23. Jeff KingOct 19, 2017
  24. 4/5 diff: fix whitespace-skipping with --color-movedJeff King, Oct 19, 2017
  25. Stefan BellerOct 19, 2017
  26. Jeff KingOct 19, 2017
  27. Simon RuderichOct 20, 2017
  28. Jeff KingOct 20, 2017
  29. 5/5 diff: handle NULs in get_string_hash()Jeff King, Oct 19, 2017
  30. Stefan BellerOct 19, 2017
  31. Jeff KingOct 19, 2017
  32. Stefan BellerOct 19, 2017
  33. Stefan BellerOct 19, 2017
  34. Jeff KingOct 19, 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.