Thread (14 messages) 14 messages, 4 authors, 2017-05-11

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

From: Stefan Beller <hidden>
Date: 2017-05-08 17:13:47

On Mon, May 8, 2017 at 9:03 AM, Marc Branchaud [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help