(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Binary diff and apply\n'>)} spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect.binary-numstat>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 37 stdin_parts: [<'1\t1\ta\n'> <'-\t-\tb\n'> <'1\t1\tc\n'> <'-\t-\td\n'>] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'prepare repository'>)} { (SQ <'\n'> <'\techo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&\n'> <'\tgit update-index --add a b c d &&\n'> <'\techo git >a &&\n'> <'\tcat "$TEST_DIRECTORY"/test-binary-1.png >b &&\n'> <'\techo git >c &&\n'> <'\tcat b b >d\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 71 stdin_parts: [ <' a | 2 +-\n'> <' b | Bin\n'> <' c | 2 +-\n'> <' d | Bin\n'> <' 4 files changed, 2 insertions(+), 2 deletions(-)\n'> ] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'apply --stat output for binary file change'>)} { (SQ <'\n'> <'\tgit diff >diff &&\n'> <'\tgit apply --stat --summary <diff >current &&\n'> <'\ttest_i18ncmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff --shortstat output for binary file change'>)} { (SQ <'\n'> <'\ttail -n 1 expected >expect &&\n'> <'\tgit diff --shortstat >current &&\n'> <'\ttest_i18ncmp expect current\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff --shortstat output for binary file change only'>)} { (SQ <'\n'> <'\techo " 1 file changed, 0 insertions(+), 0 deletions(-)" >expected &&\n'> <'\tgit diff --shortstat -- b >current &&\n'> <'\ttest_i18ncmp expected current\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply --numstat notices binary file change'>)} { (SQ <'\n'> <'\tgit diff >diff &&\n'> <'\tgit apply --numstat <diff >current &&\n'> <'\ttest_cmp expect.binary-numstat current\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply --numstat understands diff --binary format'>)} { (SQ <'\n'> <'\tgit diff --binary >diff &&\n'> <'\tgit apply --numstat <diff >current &&\n'> <'\ttest_cmp expect.binary-numstat current\n'> ) } ) (C {<test_expect_success>} {<C_LOCALE_OUTPUT>} {(SQ <'apply detecting corrupt patch correctly'>)} { (SQ <'\n'> <'\tgit diff >output &&\n'> <'\tsed -e "s/-CIT/xCIT/" <output >broken &&\n'> <'\ttest_must_fail git apply --stat --summary broken 2>detected &&\n'> <'\tdetected=$(cat detected) &&\n'> <'\tdetected=$(expr "$detected" : "error.*at line \\\\([0-9]*\\\\)\\$") &&\n'> <'\tdetected=$(sed -ne "${detected}p" broken) &&\n'> <'\ttest "$detected" = xCIT\n'> ) } ) (C {<test_expect_success>} {<C_LOCALE_OUTPUT>} {(SQ <'apply detecting corrupt patch correctly'>)} { (SQ <'\n'> <'\tgit diff --binary | sed -e "s/-CIT/xCIT/" >broken &&\n'> <'\ttest_must_fail git apply --stat --summary broken 2>detected &&\n'> <'\tdetected=$(cat detected) &&\n'> <'\tdetected=$(expr "$detected" : "error.*at line \\\\([0-9]*\\\\)\\$") &&\n'> <'\tdetected=$(sed -ne "${detected}p" broken) &&\n'> <'\ttest "$detected" = xCIT\n'> ) } ) (C {<test_expect_success>} {(SQ <'initial commit'>)} {(SQ <'git commit -a -m initial'>)}) (C {<test_expect_success>} {(SQ <'diff-index with --binary'>)} { (SQ <'\n'> <'\techo AIT >a && mv b e && echo CIT >c && cat e >d &&\n'> <'\tgit update-index --add --remove a b c d e &&\n'> <'\ttree0=$(git write-tree) &&\n'> <'\tgit diff --cached --binary >current &&\n'> <'\tgit apply --stat --summary current\n'> ) } ) (C {<test_expect_success>} {(SQ <'apply binary patch'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tgit apply --binary --index <current &&\n'> <'\ttree1=$(git write-tree) &&\n'> <'\ttest "$tree1" = "$tree0"\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff --no-index with binary creation'>)} { (SQ <'\n'> <'\techo Q | q_to_nul >binary &&\n'> <'\t(: hide error code from diff, which just indicates differences\n'> <'\t git diff --binary --no-index /dev/null binary >current ||\n'> <'\t true\n'> <'\t) &&\n'> <'\trm binary &&\n'> <'\tgit apply --binary <current &&\n'> <'\techo Q >expected &&\n'> <'\tnul_to_q <binary >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {<EOF>} here_end_span_id: 264 stdin_parts: [ <' binfile | Bin 0 -> 1026 bytes\n'> < ' textfile | 10000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n' > ] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'diff --stat with binary files and big change count'>)} { (SQ <'\n'> <'\tprintf "\\01\\00%1024d" 1 >binfile &&\n'> <'\tgit add binfile &&\n'> <'\ti=0 &&\n'> <'\twhile test $i -lt 10000; do\n'> <'\t\techo $i &&\n'> <'\t\ti=$(($i + 1))\n'> <'\tdone >textfile &&\n'> <'\tgit add textfile &&\n'> <'\tgit diff --cached --stat binfile textfile >output &&\n'> <'\tgrep " | " output >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )