From: Junio C Hamano Date: Mon, 24 Sep 2018 17:30:49 +0000 (-0700) Subject: Merge branch 'sg/t3701-tighten-trace' X-Git-Tag: v2.20.0-rc0~215 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4e08e3498a251bf2264132704545e814ff4a64f4?ds=inline;hp=-c Merge branch 'sg/t3701-tighten-trace' Test update. * sg/t3701-tighten-trace: t3701-add-interactive: tighten the check of trace output --- 4e08e3498a251bf2264132704545e814ff4a64f4 diff --combined t/t3701-add-interactive.sh index 609fbfdc31,14e82f7fb6..65dfbc033a --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@@ -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" 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" 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 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' '