(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 in reverse\n'> <'\n'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\n'> <'\tfor i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&\n'> <'\tperl -pe "y/ijk/\\\\000\\\\001\\\\002/" <file1 >file2 &&\n'> <'\n'> <'\tgit add file1 file2 &&\n'> <'\tgit commit -m initial &&\n'> <'\tgit tag initial &&\n'> <'\n'> <'\tfor i in a b c g h i J K L m o n p q; do echo $i; done >file1 &&\n'> <'\tperl -pe "y/mon/\\\\000\\\\001\\\\002/" <file1 >file2 &&\n'> <'\n'> <'\tgit commit -a -m second &&\n'> <'\tgit tag second &&\n'> <'\n'> <'\tgit diff --binary initial second >patch\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply in forward'>)} { (SQ <'\n'> <'\n'> <'\tT0=$(git rev-parse "second^{tree}") &&\n'> <'\tgit reset --hard initial &&\n'> <'\tgit apply --index --binary patch &&\n'> <'\tT1=$(git write-tree) &&\n'> <'\ttest "$T0" = "$T1"\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply in reverse'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard second &&\n'> <'\tgit apply --reverse --binary --index patch &&\n'> <'\tgit diff >diff &&\n'> <'\ttest_cmp /dev/null diff\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup separate repository lacking postimage'>)} { (SQ <'\n'> <'\n'> <'\tgit archive --format=tar --prefix=initial/ initial | $TAR xf - &&\n'> <'\t(\n'> <'\t\tcd initial && git init && git add .\n'> <'\t) &&\n'> <'\n'> <'\tgit archive --format=tar --prefix=second/ second | $TAR xf - &&\n'> <'\t(\n'> <'\t\tcd second && git init && git add .\n'> <'\t)\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply in forward without postimage'>)} { (SQ <'\n'> <'\n'> <'\tT0=$(git rev-parse "second^{tree}") &&\n'> <'\t(\n'> <'\t\tcd initial &&\n'> <'\t\tgit apply --index --binary ../patch &&\n'> <'\t\tT1=$(git write-tree) &&\n'> <'\t\ttest "$T0" = "$T1"\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply in reverse without postimage'>)} { (SQ <'\n'> <'\n'> <'\tT0=$(git rev-parse "initial^{tree}") &&\n'> <'\t(\n'> <'\t\tcd second &&\n'> <'\t\tgit apply --index --binary --reverse ../patch &&\n'> <'\t\tT1=$(git write-tree) &&\n'> <'\t\ttest "$T0" = "$T1"\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'reversing a whitespace introduction'>)} { (SQ <'\n'> <'\tsed "s/a/a /" < file1 > file1.new &&\n'> <'\tmv file1.new file1 &&\n'> <'\tgit diff | git apply --reverse --whitespace=error\n'> ) } ) (C {<test_done>}) ] )