(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'Binary diff and apply\n'>)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect.binary-numstat)} spids:[26]) (HereDoc op_id: Redir_DLess fd: -1 body: {('1\t1\ta\n') ('-\t-\tb\n') ('1\t1\tc\n') ('-\t-\td\n')} do_expansion: False here_end: EOF was_filled: True spids: [29] ) ] ) (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'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[53]) (HereDoc op_id: Redir_DLess fd: -1 body: {(' a | 2 +-\n') (' b | Bin\n') (' c | 2 +-\n') (' d | Bin\n') (' 4 files changed, 2 insertions(+), 2 deletions(-)\n') } do_expansion: False here_end: EOF was_filled: True spids: [57] ) ] ) (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'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[244]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ (' binfile | Bin 0 -> 1026 bytes\n') ( ' textfile | 10000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n' ) ) } do_expansion: True here_end: EOF was_filled: True spids: [247] ) ] ) (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)}) ] )