(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 -p handling.'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\tmkdir sub &&\n'> <'\techo A >sub/file1 &&\n'> <'\tcp sub/file1 file1.saved &&\n'> <'\tgit add sub/file1 &&\n'> <'\techo B >sub/file1 &&\n'> <'\tgit diff >patch.file &&\n'> <'\tgit checkout -- sub/file1 &&\n'> <'\tgit mv sub süb &&\n'> <'\techo B >süb/file1 &&\n'> <'\tgit diff >patch.escaped &&\n'> <'\tgrep "[\\]" patch.escaped &&\n'> <'\trm süb/file1 &&\n'> <'\trmdir süb\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply git diff with -p2'>)} {(SQ <'\n'> <'\tcp file1.saved file1 &&\n'> <'\tgit apply -p2 patch.file\n'>)} ) (C {<test_expect_success>} {(SQ <'apply with too large -p'>)} { (SQ <'\n'> <'\tcp file1.saved file1 &&\n'> <'\ttest_must_fail git apply --stat -p3 patch.file 2>err &&\n'> <'\ttest_i18ngrep "removing 3 leading" err\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply (-p2) traditional diff with funny filenames'>)} { (SQ <'\n'> <'\tcat >patch.quotes <<-\\EOF &&\n'> <'\tdiff -u "a/"sub/file1 "b/"sub/file1\n'> <'\t--- "a/"sub/file1\n'> <'\t+++ "b/"sub/file1\n'> <'\t@@ -1 +1 @@\n'> <'\t-A\n'> <'\t+B\n'> <'\tEOF\n'> <'\techo B >expected &&\n'> <'\n'> <'\tcp file1.saved file1 &&\n'> <'\tgit apply -p2 patch.quotes &&\n'> <'\ttest_cmp expected file1\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply with too large -p and fancy filename'>)} { (SQ <'\n'> <'\tcp file1.saved file1 &&\n'> <'\ttest_must_fail git apply --stat -p3 patch.escaped 2>err &&\n'> <'\ttest_i18ngrep "removing 3 leading" err\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply (-p2) diff, mode change only'>)} { (SQ <'\n'> <'\tcat >patch.chmod <<-\\EOF &&\n'> <'\tdiff --git a/sub/file1 b/sub/file1\n'> <'\told mode 100644\n'> <'\tnew mode 100755\n'> <'\tEOF\n'> <'\ttest_chmod -x file1 &&\n'> <'\tgit apply --index -p2 patch.chmod &&\n'> <'\tcase $(git ls-files -s file1) in 100755*) : good;; *) false;; esac\n'> ) } ) (C {<test_expect_success>} {<FILEMODE>} {(SQ <'file mode was changed'>)} {(SQ <'\n'> <'\ttest -x file1\n'>)} ) (C {<test_expect_success>} {(SQ <'apply (-p2) diff, rename'>)} { (SQ <'\n'> <'\tcat >patch.rename <<-\\EOF &&\n'> <'\tdiff --git a/sub/file1 b/sub/file2\n'> <'\tsimilarity index 100%\n'> <'\trename from sub/file1\n'> <'\trename to sub/file2\n'> <'\tEOF\n'> <'\techo A >expected &&\n'> <'\n'> <'\tcp file1.saved file1 &&\n'> <'\trm -f file2 &&\n'> <'\tgit apply -p2 patch.rename &&\n'> <'\ttest_cmp expected file2\n'> ) } ) (C {<test_done>}) ] )