#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # global test_description := ''git apply should handle files with incomplete lines. '' source ./test-lib.sh # setup shell {echo a; echo b} >frotz.0 shell {echo a; echo b; echo c} >frotz.1 shell {echo a; echo b | tr -d '\012'} >frotz.2 shell {echo a; echo c; echo b | tr -d '\012'} >frotz.3 for i in [0 1 2 3] { for j in [0 1 2 3] { test $i -eq $j && continue cat frotz.$i >frotz test_expect_success "apply diff between $i and $j" ' git apply <"$TEST_DIRECTORY"/t4101/diff.$i-$j && test_cmp frotz.$j frotz ' } } test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git apply should handle files with incomplete lines.\n"> <"\n">)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (Subshell child: (CommandList children: [(Sentence child:(C {(echo)} {(a)}) terminator:) (C {(echo)} {(b)})] ) redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(frotz.0)} spids:[39])] spids: [28 37] ) (Subshell child: (CommandList children: [ (Sentence child:(C {(echo)} {(a)}) terminator:) (Sentence child:(C {(echo)} {(b)}) terminator:) (C {(echo)} {(c)}) ] ) redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(frotz.1)} spids:[58])] spids: [42 56] ) (Subshell child: (CommandList children: [ (Sentence child:(C {(echo)} {(a)}) terminator:) (Pipeline children: [(C {(echo)} {(b)}) (C {(tr)} {(-d)} {(SQ <"\\012">)})] negated: False ) ] ) redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(frotz.2)} spids:[82])] spids: [61 80] ) (Subshell child: (CommandList children: [ (Sentence child:(C {(echo)} {(a)}) terminator:) (Sentence child:(C {(echo)} {(c)}) terminator:) (Pipeline children: [(C {(echo)} {(b)}) (C {(tr)} {(-d)} {(SQ <"\\012">)})] negated: False ) ] ) redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(frotz.3)} spids:[111])] spids: [85 109] ) (ForEach iter_name: i iter_words: [{(0)} {(1)} {(2)} {(3)}] do_arg_iter: False body: (DoGroup children: [ (ForEach iter_name: j iter_words: [{(0)} {(1)} {(2)} {(3)}] do_arg_iter: False body: (DoGroup children: [ (AndOr children: [ (C {(test)} {($ VSub_Name "$i")} {(-eq)} {($ VSub_Name "$j")}) (ControlFlow token:) ] op_id: Op_DAmp ) (SimpleCommand words: [{(cat)} {(frotz.) ($ VSub_Name "$i")}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(frotz)} spids:[168])] ) (C {(test_expect_success)} {(DQ ("apply diff between ") ($ VSub_Name "$i") (" and ") ($ VSub_Name "$j"))} { (SQ <"\n"> <"\tgit apply <\"$TEST_DIRECTORY\"/t4101/diff.$i-$j &&\n"> <"\ttest_cmp frotz.$j frotz\n"> <" "> ) } ) ] spids: [147 189] ) spids: [137 -1] ) ] spids: [129 191] ) spids: [120 -1] ) (C {(test_done)}) ] )