Imported Upstream version 2.19.3
[platform/upstream/git.git] / t / t2016-checkout-patch.sh
index 9cd0ac4..47aeb0b 100755 (executable)
@@ -20,33 +20,33 @@ test_expect_success PERL 'setup' '
 
 test_expect_success PERL 'saying "n" does nothing' '
        set_and_save_state dir/foo work head &&
-       (echo n; echo n) | git checkout -p &&
+       test_write_lines n n | git checkout -p &&
        verify_saved_state bar &&
        verify_saved_state dir/foo
 '
 
 test_expect_success PERL 'git checkout -p' '
-       (echo n; echo y) | git checkout -p &&
+       test_write_lines n y | git checkout -p &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
 
 test_expect_success PERL 'git checkout -p with staged changes' '
        set_state dir/foo work index &&
-       (echo n; echo y) | git checkout -p &&
+       test_write_lines n y | git checkout -p &&
        verify_saved_state bar &&
        verify_state dir/foo index index
 '
 
 test_expect_success PERL 'git checkout -p HEAD with NO staged changes: abort' '
        set_and_save_state dir/foo work head &&
-       (echo n; echo y; echo n) | git checkout -p HEAD &&
+       test_write_lines n y n | git checkout -p HEAD &&
        verify_saved_state bar &&
        verify_saved_state dir/foo
 '
 
 test_expect_success PERL 'git checkout -p HEAD with NO staged changes: apply' '
-       (echo n; echo y; echo y) | git checkout -p HEAD &&
+       test_write_lines n y y | git checkout -p HEAD &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
@@ -54,14 +54,14 @@ test_expect_success PERL 'git checkout -p HEAD with NO staged changes: apply' '
 test_expect_success PERL 'git checkout -p HEAD with change already staged' '
        set_state dir/foo index index &&
        # the third n is to get out in case it mistakenly does not apply
-       (echo n; echo y; echo n) | git checkout -p HEAD &&
+       test_write_lines n y n | git checkout -p HEAD &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
 
 test_expect_success PERL 'git checkout -p HEAD^' '
        # the third n is to get out in case it mistakenly does not apply
-       (echo n; echo y; echo n) | git checkout -p HEAD^ &&
+       test_write_lines n y n | git checkout -p HEAD^ &&
        verify_saved_state bar &&
        verify_state dir/foo parent parent
 '
@@ -69,7 +69,7 @@ test_expect_success PERL 'git checkout -p HEAD^' '
 test_expect_success PERL 'git checkout -p handles deletion' '
        set_state dir/foo work index &&
        rm dir/foo &&
-       (echo n; echo y) | git checkout -p &&
+       test_write_lines n y | git checkout -p &&
        verify_saved_state bar &&
        verify_state dir/foo index index
 '
@@ -81,21 +81,21 @@ test_expect_success PERL 'git checkout -p handles deletion' '
 
 test_expect_success PERL 'path limiting works: dir' '
        set_state dir/foo work head &&
-       (echo y; echo n) | git checkout -p dir &&
+       test_write_lines y n | git checkout -p dir &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
 
 test_expect_success PERL 'path limiting works: -- dir' '
        set_state dir/foo work head &&
-       (echo y; echo n) | git checkout -p -- dir &&
+       test_write_lines y n | git checkout -p -- dir &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
 
 test_expect_success PERL 'path limiting works: HEAD^ -- dir' '
        # the third n is to get out in case it mistakenly does not apply
-       (echo y; echo n; echo n) | git checkout -p HEAD^ -- dir &&
+       test_write_lines y n n | git checkout -p HEAD^ -- dir &&
        verify_saved_state bar &&
        verify_state dir/foo parent parent
 '
@@ -103,7 +103,7 @@ test_expect_success PERL 'path limiting works: HEAD^ -- dir' '
 test_expect_success PERL 'path limiting works: foo inside dir' '
        set_state dir/foo work head &&
        # the third n is to get out in case it mistakenly does not apply
-       (echo y; echo n; echo n) | (cd dir && git checkout -p foo) &&
+       test_write_lines y n n | (cd dir && git checkout -p foo) &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '