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

Re: [PATCH v4 0/4] Make diff plumbing commands respect the indentHeuristic.

From
Stefan Beller <sbeller@google.com>
Date
May 8, 2017, 17:13 UTC
Message-ID
<CAGZ79kbLKQ0jS0xfQO1MSp5T2_m9dShx0oYeTDAjDdUcydm3uQ@mail.gmail.com>
In-Reply-To
<20170508160339.4551-1-marcnarc@xiplink.com>
On Mon, May 8, 2017 at 9:03 AM, Marc Branchaud <marcnarc@xiplink.com> wrote:
Show 59 quoted lines
> The only change from v3 is in 3/4, to expand t4061 to test various
> combinations of --(no-)indent-heuristic and diff.indentHeuristic.
>
> I kindof went all-in and tried to cover every possible combination for
> all four affected commands.
>
> An inter-diff is below.
>
>                 M.
>
> Jeff King (1):
>   add--interactive: drop diff.indentHeuristic handling
>
> Marc Branchaud (2):
>   diff: make the indent heuristic part of diff's basic configuration
>   diff: have the diff-* builtins configure diff before initializing
>     revisions
>
> Stefan Beller (1):
>   diff: enable indent heuristic by default
>
>  builtin/diff-files.c             |   2 +-
>  builtin/diff-index.c             |   2 +-
>  builtin/diff-tree.c              |   2 +-
>  diff.c                           |   8 +-
>  git-add--interactive.perl        |   4 -
>  t/t4051-diff-function-context.sh |   3 +-
>  t/t4061-diff-indent.sh           | 184 +++++++++++++++++++++++++++++++++++----
>  7 files changed, 177 insertions(+), 28 deletions(-)
>
>
> diff --git a/t/t4061-diff-indent.sh b/t/t4061-diff-indent.sh
> index 56d7d7760..2affd7a10 100755
> --- a/t/t4061-diff-indent.sh
> +++ b/t/t4061-diff-indent.sh
> @@ -152,26 +152,28 @@ test_expect_success 'prepare' '
>         EOF
>  '
>
> +# --- diff tests ----------------------------------------------------------
> +
>  test_expect_success 'diff: ugly spaces' '
>         git diff --no-indent-heuristic old new -- spaces.txt >out &&
>         compare_diff spaces-expect out
>  '
>
> +test_expect_success 'diff: --no-indent-heuristic overrides config' '
> +       git -c diff.indentHeuristic=true diff --no-indent-heuristic old new -- spaces.txt >out2 &&
> +       compare_diff spaces-expect out2
> +'
> +
>  test_expect_success 'diff: nice spaces with --indent-heuristic' '
> -       git diff --indent-heuristic old new -- spaces.txt >out-compacted &&
> +       git -c diff.indentHeuristic=false diff --indent-heuristic old new -- spaces.txt >out-compacted &&
>         compare_diff spaces-compacted-expect out-compacted
>  '
>
> -test_expect_success 'diff: nice spaces with diff.indentHeuristic' '
> +test_expect_success 'diff: nice spaces with diff.indentHeuristic=true' '

Adding the '=true' seems weird to me (I'd think the true is implied, similar to C, where we do "if (!null_pointer)" instead of an explicit "!=null". However we do have these '=true' sprinkled all over the tests, so I guess it is a valid dialect in our test suite.

The tests (just looked at the interdiff) look good to me.

Thanks, Stefan

Previous: Marc BranchaudNext: Jeff King
Message 11 of 14 in “What's cooking in git.git (May 2017, #02; Mon, 8)”
  1. Junio C HamanoMay 8, 2017
  2. Enabling the diff "indent" heuristic by defaultMarc Branchaud, May 8, 2017
  3. 0/4 Make diff plumbing commands respect the indentHeuristic.Marc Branchaud, May 8, 2017
  4. 1/4 diff: make the indent heuristic part of diff's basic configurationMarc Branchaud, May 8, 2017
  5. 4/4 add--interactive: drop diff.indentHeuristic handlingMarc Branchaud, May 8, 2017
  6. Jeff KingMay 9, 2017
  7. 2/4 diff: have the diff-* builtins configure diff before initializing revisionsMarc Branchaud, May 8, 2017
  8. Jeff KingMay 9, 2017
  9. Marc BranchaudMay 11, 2017
  10. 3/4 diff: enable indent heuristic by defaultMarc Branchaud, May 8, 2017
  11. Stefan BellerMay 8, 2017
  12. Jeff KingMay 9, 2017
  13. Jeff KingMay 9, 2017
  14. Jeff KingMay 9, 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.