Merge branch 'sg/t3701-tighten-trace'
authorJunio C Hamano <gitster@pobox.com>
Mon, 24 Sep 2018 17:30:49 +0000 (10:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Sep 2018 17:30:49 +0000 (10:30 -0700)
Test update.

* sg/t3701-tighten-trace:
t3701-add-interactive: tighten the check of trace output

1  2 
t/t3701-add-interactive.sh
index 609fbfdc317137e420fab48e394f0095b0a1df69,14e82f7fb6c1704eb47bc9d5dfc8dab85a79c845..65dfbc033a027df1a590cbfaf75ae47f4ed9c547
@@@ -46,13 -46,13 +46,13 @@@ test_expect_success 'setup expected' 
  '
  
  test_expect_success 'diff works (initial)' '
 -      (echo d; echo 1) | git add -i >output &&
 +      test_write_lines d 1 | git add -i >output &&
        sed -ne "/new file/,/content/p" <output >diff &&
        diff_cmp expected diff
  '
  test_expect_success 'revert works (initial)' '
        git add file &&
 -      (echo r; echo 1) | git add -i &&
 +      test_write_lines r 1 | git add -i &&
        git ls-files >output &&
        ! grep . output
  '
@@@ -83,13 -83,13 +83,13 @@@ test_expect_success 'setup expected' 
  '
  
  test_expect_success 'diff works (commit)' '
 -      (echo d; echo 1) | git add -i >output &&
 +      test_write_lines d 1 | git add -i >output &&
        sed -ne "/^index/,/content/p" <output >diff &&
        diff_cmp expected diff
  '
  test_expect_success 'revert works (commit)' '
        git add file &&
 -      (echo r; echo 1) | git add -i &&
 +      test_write_lines r 1 | git add -i &&
        git add -i </dev/null >output &&
        grep "unchanged *+3/-0 file" output
  '
@@@ -102,7 -102,7 +102,7 @@@ test_expect_success 'setup expected' 
  
  test_expect_success 'dummy edit works' '
        test_set_editor : &&
 -      (echo e; echo a) | git add -p &&
 +      test_write_lines e a | git add -p &&
        git diff > diff &&
        diff_cmp expected diff
  '
@@@ -127,7 -127,7 +127,7 @@@ test_expect_success 'setup fake editor
  
  test_expect_success 'bad edit rejected' '
        git reset &&
 -      (echo e; echo n; echo d) | git add -p >output &&
 +      test_write_lines e n d | git add -p >output &&
        grep "hunk does not apply" output
  '
  
@@@ -140,7 -140,7 +140,7 @@@ test_expect_success 'setup patch' 
  
  test_expect_success 'garbage edit rejected' '
        git reset &&
 -      (echo e; echo n; echo d) | git add -p >output &&
 +      test_write_lines e n d | git add -p >output &&
        grep "hunk does not apply" output
  '
  
@@@ -170,50 -170,7 +170,50 @@@ test_expect_success 'setup expected' 
  '
  
  test_expect_success 'real edit works' '
 -      (echo e; echo n; echo d) | git add -p &&
 +      test_write_lines e n d | git add -p &&
 +      git diff >output &&
 +      diff_cmp expected output
 +'
 +
 +test_expect_success 'setup file' '
 +      test_write_lines a "" b "" c >file &&
 +      git add file &&
 +      test_write_lines a "" d "" c >file
 +'
 +
 +test_expect_success 'setup patch' '
 +      SP=" " &&
 +      NULL="" &&
 +      cat >patch <<-EOF
 +      @@ -1,4 +1,4 @@
 +       a
 +      $NULL
 +      -b
 +      +f
 +      $SP
 +      c
 +      EOF
 +'
 +
 +test_expect_success 'setup expected' '
 +      cat >expected <<-EOF
 +      diff --git a/file b/file
 +      index b5dd6c9..f910ae9 100644
 +      --- a/file
 +      +++ b/file
 +      @@ -1,5 +1,5 @@
 +       a
 +      $SP
 +      -f
 +      +d
 +      $SP
 +       c
 +      EOF
 +'
 +
 +test_expect_success 'edit can strip spaces from empty context lines' '
 +      test_write_lines e n q | git add -p 2>error &&
 +      test_must_be_empty error &&
        git diff >output &&
        diff_cmp expected output
  '
@@@ -540,7 -497,7 +540,7 @@@ test_expect_success 'add -p does not ex
        # update it, but we want to be sure that our "." pathspec
        # was not expanded into the argument list of any command.
        # So look only for "not-changed".
-       ! grep not-changed trace.out
+       ! grep -E "^trace: (built-in|exec|run_command): .*not-changed" trace.out
  '
  
  test_expect_success 'hunk-editing handles custom comment char' '