(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'git apply with rejects\n'> <'\n'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\tfor i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21\n'> <'\tdo\n'> <'\t\techo $i\n'> <'\tdone >file1 &&\n'> <'\tcat file1 >saved.file1 &&\n'> <'\tgit update-index --add file1 &&\n'> <'\tgit commit -m initial &&\n'> <'\n'> <'\tfor i in 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21\n'> <'\tdo\n'> <'\t\techo $i\n'> <'\tdone >file1 &&\n'> <'\tgit diff >patch.1 &&\n'> <'\tcat file1 >clean &&\n'> <'\n'> <'\tfor i in 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21\n'> <'\tdo\n'> <'\t\techo $i\n'> <'\tdone >expected &&\n'> <'\n'> <'\tmv file1 file2 &&\n'> <'\tgit update-index --add --remove file1 file2 &&\n'> <'\tgit diff -M HEAD >patch.2 &&\n'> <'\n'> <'\trm -f file1 file2 &&\n'> <'\tmv saved.file1 file1 &&\n'> <'\tgit update-index --add --remove file1 file2 &&\n'> <'\n'> <'\tfor i in 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21\n'> <'\tdo\n'> <'\t\techo $i\n'> <'\tdone >file1 &&\n'> <'\n'> <'\tcat file1 >saved.file1\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply --reject is incompatible with --3way'>)} { (SQ <'\n'> <'\ttest_when_finished "cat saved.file1 >file1" &&\n'> <'\tgit diff >patch.0 &&\n'> <'\tgit checkout file1 &&\n'> <'\ttest_must_fail git apply --reject --3way patch.0 &&\n'> <'\tgit diff --exit-code\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply without --reject should fail'>)} { (SQ <'\n'> <'\n'> <'\ttest_must_fail git apply patch.1 &&\n'> <'\ttest_cmp file1 saved.file1\n'>) } ) (C {<test_expect_success>} {(SQ <'apply without --reject should fail'>)} { (SQ <'\n'> <'\n'> <'\ttest_must_fail git apply --verbose patch.1 &&\n'> <'\ttest_cmp file1 saved.file1\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply with --reject should fail but update the file'>)} { (SQ <'\n'> <'\n'> <'\tcat saved.file1 >file1 &&\n'> <'\trm -f file1.rej file2.rej &&\n'> <'\n'> <'\ttest_must_fail git apply --reject patch.1 &&\n'> <'\ttest_cmp file1 expected &&\n'> <'\n'> <'\tcat file1.rej &&\n'> <'\ttest_path_is_missing file2.rej\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply with --reject should fail but update the file'>)} { (SQ <'\n'> <'\n'> <'\tcat saved.file1 >file1 &&\n'> <'\trm -f file1.rej file2.rej file2 &&\n'> <'\n'> <'\ttest_must_fail git apply --reject patch.2 >rejects &&\n'> <'\ttest_path_is_missing file1 &&\n'> <'\ttest_cmp file2 expected &&\n'> <'\n'> <'\tcat file2.rej &&\n'> <'\ttest_path_is_missing file1.rej\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'the same test with --verbose'>)} { (SQ <'\n'> <'\n'> <'\tcat saved.file1 >file1 &&\n'> <'\trm -f file1.rej file2.rej file2 &&\n'> <'\n'> <'\ttest_must_fail git apply --reject --verbose patch.2 >rejects &&\n'> <'\ttest_path_is_missing file1 &&\n'> <'\ttest_cmp file2 expected &&\n'> <'\n'> <'\tcat file2.rej &&\n'> <'\ttest_path_is_missing file1.rej\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply cleanly with --verbose'>)} { (SQ <'\n'> <'\n'> <'\tgit cat-file -p HEAD:file1 >file1 &&\n'> <'\trm -f file?.rej file2 &&\n'> <'\n'> <'\tgit apply --verbose patch.1 &&\n'> <'\n'> <'\ttest_cmp file1 clean\n'> ) } ) (C {<test_done>}) ] )