(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'CRLF conversion' span_id:6))} spids: [4] ) ] ) (C {(.)} {(./test-lib.sh)}) (command.ShFunction name: has_cr body: (command.BraceGroup children: [ (command.Pipeline children: [ (command.Simple words: [{(tr)} {(SQ (Token id:Id.Lit_Chars val:'\\015' span_id:25))} {(Q)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:30) fd: -1 arg_word: {(DQ ($ Id.VSub_Number '$1'))} ) ] ) (command.Simple words: [{(grep)} {(Q)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:41) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) (command.ShFunction name: munge_cr body: (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [{(DQ (${ Id.VSub_Number 1) (_cr))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:68) fd: -1 arg_word: {(DQ ($ Id.VSub_Number '$2'))} ) (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:73) fd: -1 arg_word: {(tmp)} ) ] ) (C {(mv)} {(tmp)} {(DQ ($ Id.VSub_Number '$2'))}) ] ) ] ) ) (C {(test_expect_success)} {(setup)} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:95) (Token id:Id.Lit_Chars val:'\n' span_id:96) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf false &&\n' span_id:97) (Token id:Id.Lit_Chars val:'\n' span_id:98) (Token id: Id.Lit_Chars val: '\tfor w in Hello world how are you; do echo $w; done >one &&\n' span_id: 99 ) (Token id:Id.Lit_Chars val:'\tmkdir dir &&\n' span_id:100) (Token id: Id.Lit_Chars val: '\tfor w in I am very very fine thank you; do echo $w; done >dir/two &&\n' span_id: 101 ) (Token id: Id.Lit_Chars val: '\tfor w in Oh here is NULQin text here; do echo $w; done | q_to_nul >three &&\n' span_id: 102 ) (Token id:Id.Lit_Chars val:'\tgit add . &&\n' span_id:103) (Token id:Id.Lit_Chars val:'\n' span_id:104) (Token id:Id.Lit_Chars val:'\tgit commit -m initial &&\n' span_id:105) (Token id:Id.Lit_Chars val:'\n' span_id:106) (Token id:Id.Lit_Chars val:'\tone=$(git rev-parse HEAD:one) &&\n' span_id:107) (Token id:Id.Lit_Chars val:'\tdir=$(git rev-parse HEAD:dir) &&\n' span_id:108) (Token id:Id.Lit_Chars val:'\ttwo=$(git rev-parse HEAD:dir/two) &&\n' span_id:109) (Token id: Id.Lit_Chars val: '\tthree=$(git rev-parse HEAD:three) &&\n' span_id: 110 ) (Token id:Id.Lit_Chars val:'\n' span_id:111) (Token id: Id.Lit_Chars val: '\tfor w in Some extra lines here; do echo $w; done >>one &&\n' span_id: 112 ) (Token id:Id.Lit_Chars val:'\tgit diff >patch.file &&\n' span_id:113) (Token id: Id.Lit_Chars val: '\tpatched=$(git hash-object --stdin <one) &&\n' span_id: 114 ) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD\n' span_id:115) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'safecrlf: autocrlf=input, all CRLF' span_id:122))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:126) (Token id:Id.Lit_Chars val:'\n' span_id:127) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:128) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf true &&\n' span_id:129) (Token id:Id.Lit_Chars val:'\n' span_id:130) (Token id: Id.Lit_Chars val: '\tfor w in I am all CRLF; do echo $w; done | append_cr >allcrlf &&\n' span_id: 131 ) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add allcrlf\n' span_id:132) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'safecrlf: autocrlf=input, mixed LF/CRLF' span_id:139))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:143) (Token id:Id.Lit_Chars val:'\n' span_id:144) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:145) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf true &&\n' span_id:146) (Token id:Id.Lit_Chars val:'\n' span_id:147) (Token id: Id.Lit_Chars val: '\tfor w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&\n' span_id: 148 ) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add mixed\n' span_id:149) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'safecrlf: autocrlf=true, all LF' span_id:156))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:160) (Token id:Id.Lit_Chars val:'\n' span_id:161) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:162) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf true &&\n' span_id:163) (Token id:Id.Lit_Chars val:'\n' span_id:164) (Token id:Id.Lit_Chars val:'\tfor w in I am all LF; do echo $w; done >alllf &&\n' span_id:165) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add alllf\n' span_id:166) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'safecrlf: autocrlf=true mixed LF/CRLF' span_id:173))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:177) (Token id:Id.Lit_Chars val:'\n' span_id:178) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:179) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf true &&\n' span_id:180) (Token id:Id.Lit_Chars val:'\n' span_id:181) (Token id: Id.Lit_Chars val: '\tfor w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&\n' span_id: 182 ) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add mixed\n' span_id:183) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'safecrlf: print warning only once' span_id:190))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:194) (Token id:Id.Lit_Chars val:'\n' span_id:195) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:196) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf warn &&\n' span_id:197) (Token id:Id.Lit_Chars val:'\n' span_id:198) (Token id:Id.Lit_Chars val:'\tfor w in I am all LF; do echo $w; done >doublewarn &&\n' span_id:199) (Token id:Id.Lit_Chars val:'\tgit add doublewarn &&\n' span_id:200) (Token id:Id.Lit_Chars val:'\tgit commit -m "nowarn" &&\n' span_id:201) (Token id: Id.Lit_Chars val: '\tfor w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn &&\n' span_id: 202 ) (Token id:Id.Lit_Chars val:'\tgit add doublewarn 2>err &&\n' span_id:203) (Token id:Id.Lit_Chars val:'\tif test_have_prereq C_LOCALE_OUTPUT\n' span_id:204) (Token id:Id.Lit_Chars val:'\tthen\n' span_id:205) (Token id: Id.Lit_Chars val: '\t\ttest $(grep "CRLF will be replaced by LF" err | wc -l) = 1\n' span_id: 206 ) (Token id:Id.Lit_Chars val:'\tfi\n' span_id:207) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'safecrlf: git diff demotes safecrlf=true to warn' span_id: 215 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:219) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:220) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf true &&\n' span_id:221) (Token id:Id.Lit_Chars val:'\tgit diff HEAD\n' span_id:222) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'switch off autocrlf, safecrlf, reset HEAD' span_id:230))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:234) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf false &&\n' span_id:235) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf false &&\n' span_id:236) (Token id:Id.Lit_Chars val:'\tgit reset --hard HEAD^\n' span_id:237) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'update with autocrlf=input' span_id:244))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:248) (Token id:Id.Lit_Chars val:'\n' span_id:249) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:250) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:251) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:252) (Token id:Id.Lit_Chars val:'\tmunge_cr append one &&\n' span_id:253) (Token id:Id.Lit_Chars val:'\tmunge_cr append dir/two &&\n' span_id:254) (Token id:Id.Lit_Chars val:'\tgit update-index -- one dir/two &&\n' span_id:255) (Token id: Id.Lit_Chars val: '\tdiffers=$(git diff-index --cached HEAD) &&\n' span_id: 256 ) (Token id:Id.Lit_Chars val:'\tverbose test -z "$differs"\n' span_id:257) (Token id:Id.Lit_Chars val:'\n' span_id:258) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'update with autocrlf=true' span_id:265))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:269) (Token id:Id.Lit_Chars val:'\n' span_id:270) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:271) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:272) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:273) (Token id:Id.Lit_Chars val:'\tmunge_cr append one &&\n' span_id:274) (Token id:Id.Lit_Chars val:'\tmunge_cr append dir/two &&\n' span_id:275) (Token id:Id.Lit_Chars val:'\tgit update-index -- one dir/two &&\n' span_id:276) (Token id: Id.Lit_Chars val: '\tdiffers=$(git diff-index --cached HEAD) &&\n' span_id: 277 ) (Token id:Id.Lit_Chars val:'\tverbose test -z "$differs"\n' span_id:278) (Token id:Id.Lit_Chars val:'\n' span_id:279) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout with autocrlf=true' span_id:286))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:290) (Token id:Id.Lit_Chars val:'\n' span_id:291) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:292) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:293) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:294) (Token id:Id.Lit_Chars val:'\tmunge_cr remove one &&\n' span_id:295) (Token id:Id.Lit_Chars val:'\tmunge_cr remove dir/two &&\n' span_id:296) (Token id:Id.Lit_Chars val:'\tgit update-index -- one dir/two &&\n' span_id:297) (Token id: Id.Lit_Chars val: '\ttest "$one" = $(git hash-object --stdin <one) &&\n' span_id: 298 ) (Token id:Id.Lit_Chars val:'\ttest "$two" = $(git hash-object --stdin <dir/two) &&\n' span_id:299) (Token id: Id.Lit_Chars val: '\tdiffers=$(git diff-index --cached HEAD) &&\n' span_id: 300 ) (Token id:Id.Lit_Chars val:'\tverbose test -z "$differs"\n' span_id:301) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout with autocrlf=input' span_id:308))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:312) (Token id:Id.Lit_Chars val:'\n' span_id:313) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:314) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:315) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:316) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr one &&\n' span_id:317) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr two &&\n' span_id:318) (Token id:Id.Lit_Chars val:'\tgit update-index -- one dir/two &&\n' span_id:319) (Token id: Id.Lit_Chars val: '\ttest "$one" = $(git hash-object --stdin <one) &&\n' span_id: 320 ) (Token id:Id.Lit_Chars val:'\ttest "$two" = $(git hash-object --stdin <dir/two) &&\n' span_id:321) (Token id: Id.Lit_Chars val: '\tdiffers=$(git diff-index --cached HEAD) &&\n' span_id: 322 ) (Token id:Id.Lit_Chars val:'\tverbose test -z "$differs"\n' span_id:323) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply patch (autocrlf=input)' span_id:330))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:334) (Token id:Id.Lit_Chars val:'\n' span_id:335) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:336) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:337) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:338) (Token id:Id.Lit_Chars val:'\n' span_id:339) (Token id:Id.Lit_Chars val:'\tgit apply patch.file &&\n' span_id:340) (Token id: Id.Lit_Chars val: '\tverbose test "$patched" = "$(git hash-object --stdin <one)"\n' span_id: 341 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply patch --cached (autocrlf=input)' span_id:348))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:352) (Token id:Id.Lit_Chars val:'\n' span_id:353) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:354) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:355) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:356) (Token id:Id.Lit_Chars val:'\n' span_id:357) (Token id:Id.Lit_Chars val:'\tgit apply --cached patch.file &&\n' span_id:358) (Token id:Id.Lit_Chars val:'\tverbose test "$patched" = $(git rev-parse :one)\n' span_id:359) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply patch --index (autocrlf=input)' span_id:366))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:370) (Token id:Id.Lit_Chars val:'\n' span_id:371) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:372) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf input &&\n' span_id:373) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:374) (Token id:Id.Lit_Chars val:'\n' span_id:375) (Token id:Id.Lit_Chars val:'\tgit apply --index patch.file &&\n' span_id:376) (Token id:Id.Lit_Chars val:'\tverbose test "$patched" = $(git rev-parse :one) &&\n' span_id:377) (Token id: Id.Lit_Chars val: '\tverbose test "$patched" = $(git hash-object --stdin <one)\n' span_id: 378 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply patch (autocrlf=true)' span_id:385))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:389) (Token id:Id.Lit_Chars val:'\n' span_id:390) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:391) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:392) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:393) (Token id:Id.Lit_Chars val:'\n' span_id:394) (Token id:Id.Lit_Chars val:'\tgit apply patch.file &&\n' span_id:395) (Token id: Id.Lit_Chars val: '\tverbose test "$patched" = "$(remove_cr <one | git hash-object --stdin)"\n' span_id: 396 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply patch --cached (autocrlf=true)' span_id:403))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:407) (Token id:Id.Lit_Chars val:'\n' span_id:408) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:409) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:410) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:411) (Token id:Id.Lit_Chars val:'\n' span_id:412) (Token id:Id.Lit_Chars val:'\tgit apply --cached patch.file &&\n' span_id:413) (Token id:Id.Lit_Chars val:'\tverbose test "$patched" = $(git rev-parse :one)\n' span_id:414) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'apply patch --index (autocrlf=true)' span_id:421))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:425) (Token id:Id.Lit_Chars val:'\n' span_id:426) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:427) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:428) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:429) (Token id:Id.Lit_Chars val:'\n' span_id:430) (Token id:Id.Lit_Chars val:'\tgit apply --index patch.file &&\n' span_id:431) (Token id:Id.Lit_Chars val:'\tverbose test "$patched" = $(git rev-parse :one) &&\n' span_id:432) (Token id: Id.Lit_Chars val: '\tverbose test "$patched" = "$(remove_cr <one | git hash-object --stdin)"\n' span_id: 433 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'.gitattributes says two is binary' span_id:440))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:444) (Token id:Id.Lit_Chars val:'\n' span_id:445) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:446) (Token id:Id.Lit_Chars val:'\techo "two -crlf" >.gitattributes &&\n' span_id:447) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:448) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:449) (Token id:Id.Lit_Chars val:'\n' span_id:450) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr dir/two &&\n' span_id:451) (Token id:Id.Lit_Chars val:'\tverbose has_cr one &&\n' span_id:452) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr three\n' span_id:453) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'.gitattributes says two is input' span_id:460))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:464) (Token id:Id.Lit_Chars val:'\n' span_id:465) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:466) (Token id:Id.Lit_Chars val:'\techo "two crlf=input" >.gitattributes &&\n' span_id:467) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:468) (Token id:Id.Lit_Chars val:'\n' span_id:469) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr dir/two\n' span_id:470) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'.gitattributes says two and three are text' span_id:477))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:481) (Token id:Id.Lit_Chars val:'\n' span_id:482) (Token id:Id.Lit_Chars val:'\trm -f tmp one dir/two three &&\n' span_id:483) (Token id:Id.Lit_Chars val:'\techo "t* crlf" >.gitattributes &&\n' span_id:484) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:485) (Token id:Id.Lit_Chars val:'\n' span_id:486) (Token id:Id.Lit_Chars val:'\tverbose has_cr dir/two &&\n' span_id:487) (Token id:Id.Lit_Chars val:'\tverbose has_cr three\n' span_id:488) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'in-tree .gitattributes (1)' span_id:495))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:499) (Token id:Id.Lit_Chars val:'\n' span_id:500) (Token id: Id.Lit_Chars val: '\techo "one -crlf" >>.gitattributes &&\n' span_id: 501 ) (Token id:Id.Lit_Chars val:'\tgit add .gitattributes &&\n' span_id:502) (Token id: Id.Lit_Chars val: '\tgit commit -m "Add .gitattributes" &&\n' span_id: 503 ) (Token id:Id.Lit_Chars val:'\n' span_id:504) (Token id: Id.Lit_Chars val: '\trm -rf tmp one dir .gitattributes patch.file three &&\n' span_id: 505 ) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset -u HEAD &&\n' span_id:506) (Token id:Id.Lit_Chars val:'\n' span_id:507) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr one &&\n' span_id:508) (Token id:Id.Lit_Chars val:'\tverbose has_cr three\n' span_id:509) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'in-tree .gitattributes (2)' span_id:516))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:520) (Token id:Id.Lit_Chars val:'\n' span_id:521) (Token id: Id.Lit_Chars val: '\trm -rf tmp one dir .gitattributes patch.file three &&\n' span_id: 522 ) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset HEAD &&\n' span_id:523) (Token id:Id.Lit_Chars val:'\tgit checkout-index -f -q -u -a &&\n' span_id:524) (Token id:Id.Lit_Chars val:'\n' span_id:525) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr one &&\n' span_id:526) (Token id:Id.Lit_Chars val:'\tverbose has_cr three\n' span_id:527) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'in-tree .gitattributes (3)' span_id:534))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:538) (Token id:Id.Lit_Chars val:'\n' span_id:539) (Token id: Id.Lit_Chars val: '\trm -rf tmp one dir .gitattributes patch.file three &&\n' span_id: 540 ) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset HEAD &&\n' span_id:541) (Token id: Id.Lit_Chars val: '\tgit checkout-index -u .gitattributes &&\n' span_id: 542 ) (Token id:Id.Lit_Chars val:'\tgit checkout-index -u one dir/two three &&\n' span_id:543) (Token id:Id.Lit_Chars val:'\n' span_id:544) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr one &&\n' span_id:545) (Token id:Id.Lit_Chars val:'\tverbose has_cr three\n' span_id:546) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'in-tree .gitattributes (4)' span_id:553))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:557) (Token id:Id.Lit_Chars val:'\n' span_id:558) (Token id: Id.Lit_Chars val: '\trm -rf tmp one dir .gitattributes patch.file three &&\n' span_id: 559 ) (Token id:Id.Lit_Chars val:'\tgit read-tree --reset HEAD &&\n' span_id:560) (Token id: Id.Lit_Chars val: '\tgit checkout-index -u one dir/two three &&\n' span_id: 561 ) (Token id:Id.Lit_Chars val:'\tgit checkout-index -u .gitattributes &&\n' span_id:562) (Token id:Id.Lit_Chars val:'\n' span_id:563) (Token id:Id.Lit_Chars val:'\ttest_must_fail has_cr one &&\n' span_id:564) (Token id:Id.Lit_Chars val:'\tverbose has_cr three\n' span_id:565) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout with existing .gitattributes' span_id:572))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:576) (Token id:Id.Lit_Chars val:'\n' span_id:577) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:578) (Token id:Id.Lit_Chars val:'\tgit config --unset core.safecrlf &&\n' span_id:579) (Token id: Id.Lit_Chars val: '\techo ".file2 -crlfQ" | q_to_cr >> .gitattributes &&\n' span_id: 580 ) (Token id:Id.Lit_Chars val:'\tgit add .gitattributes &&\n' span_id:581) (Token id:Id.Lit_Chars val:'\tgit commit -m initial &&\n' span_id:582) (Token id:Id.Lit_Chars val:'\techo ".file -crlfQ" | q_to_cr >> .gitattributes &&\n' span_id:583) (Token id:Id.Lit_Chars val:'\techo "contents" > .file &&\n' span_id:584) (Token id:Id.Lit_Chars val:'\tgit add .gitattributes .file &&\n' span_id:585) (Token id:Id.Lit_Chars val:'\tgit commit -m second &&\n' span_id:586) (Token id:Id.Lit_Chars val:'\n' span_id:587) (Token id:Id.Lit_Chars val:'\tgit checkout master~1 &&\n' span_id:588) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:589) (Token id:Id.Lit_Chars val:'\ttest "$(git diff-files --raw)" = ""\n' span_id:590) (Token id:Id.Lit_Chars val:'\n' span_id:591) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'checkout when deleting .gitattributes' span_id:598))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:602) (Token id:Id.Lit_Chars val:'\n' span_id:603) (Token id:Id.Lit_Chars val:'\tgit rm .gitattributes &&\n' span_id:604) (Token id:Id.Lit_Chars val:'\techo "contentsQ" | q_to_cr > .file2 &&\n' span_id:605) (Token id:Id.Lit_Chars val:'\tgit add .file2 &&\n' span_id:606) (Token id:Id.Lit_Chars val:'\tgit commit -m third &&\n' span_id:607) (Token id:Id.Lit_Chars val:'\n' span_id:608) (Token id:Id.Lit_Chars val:'\tgit checkout master~1 &&\n' span_id:609) (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:610) (Token id:Id.Lit_Chars val:'\thas_cr .file2\n' span_id:611) (Token id:Id.Lit_Chars val:'\n' span_id:612) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'invalid .gitattributes (must not crash)' span_id:619))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:623) (Token id:Id.Lit_Chars val:'\n' span_id:624) (Token id: Id.Lit_Chars val: '\techo "three +crlf" >>.gitattributes &&\n' span_id: 625 ) (Token id:Id.Lit_Chars val:'\tgit diff\n' span_id:626) (Token id:Id.Lit_Chars val:'\n' span_id:627) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'setting up for new autocrlf tests' span_id:640))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:644) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf false &&\n' span_id:645) (Token id:Id.Lit_Chars val:'\tgit config core.safecrlf false &&\n' span_id:646) (Token id:Id.Lit_Chars val:'\trm -rf .????* * &&\n' span_id:647) (Token id:Id.Lit_Chars val:'\tfor w in I am all LF; do echo $w; done >alllf &&\n' span_id:648) (Token id: Id.Lit_Chars val: '\tfor w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&\n' span_id: 649 ) (Token id: Id.Lit_Chars val: '\tfor w in I am all CRLF; do echo $w; done | append_cr >allcrlf &&\n' span_id: 650 ) (Token id:Id.Lit_Chars val:'\tgit add -A . &&\n' span_id:651) (Token id: Id.Lit_Chars val: '\tgit commit -m "alllf, allcrlf and mixed only" &&\n' span_id: 652 ) (Token id:Id.Lit_Chars val:'\tgit tag -a -m "message" autocrlf-checkpoint\n' span_id:653) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'report no change after setting autocrlf' span_id:660))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:664) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf true &&\n' span_id:665) (Token id:Id.Lit_Chars val:'\ttouch * &&\n' span_id:666) (Token id:Id.Lit_Chars val:'\tgit diff --exit-code\n' span_id:667) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'files are clean after checkout' span_id:674))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:678) (Token id:Id.Lit_Chars val:'\trm * &&\n' span_id:679) (Token id:Id.Lit_Chars val:'\tgit checkout -f &&\n' span_id:680) (Token id:Id.Lit_Chars val:'\tgit diff --exit-code\n' span_id:681) ) } ) (command.ShFunction name: cr_to_Q_no_NL body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {(tr)} {(SQ (Token id:Id.Lit_Chars val:'\\015' span_id:696))} {(Q)}) (C {(tr)} {(-d)} {(SQ (Token id:Id.Lit_Chars val:'\\012' span_id:708))}) ] negated: F ) ] ) ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'LF only file gets CRLF with autocrlf' span_id:717))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:721) (Token id: Id.Lit_Chars val: '\ttest "$(cr_to_Q_no_NL < alllf)" = "IQamQallQLFQ"\n' span_id: 722 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'Mixed file is still mixed with autocrlf' span_id:729))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:733) (Token id: Id.Lit_Chars val: '\ttest "$(cr_to_Q_no_NL < mixed)" = "OhhereisCRLFQintext"\n' span_id: 734 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'CRLF only file has CRLF with autocrlf' span_id:741))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:745) (Token id: Id.Lit_Chars val: '\ttest "$(cr_to_Q_no_NL < allcrlf)" = "IQamQallQCRLFQ"\n' span_id: 746 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'New CRLF file gets LF in repo' span_id:753))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:757) (Token id: Id.Lit_Chars val: '\ttr -d "\\015" < alllf | append_cr > alllf2 &&\n' span_id: 758 ) (Token id:Id.Lit_Chars val:'\tgit add alllf2 &&\n' span_id:759) (Token id:Id.Lit_Chars val:'\tgit commit -m "alllf2 added" &&\n' span_id:760) (Token id:Id.Lit_Chars val:'\tgit config core.autocrlf false &&\n' span_id:761) (Token id:Id.Lit_Chars val:'\trm * &&\n' span_id:762) (Token id:Id.Lit_Chars val:'\tgit checkout -f &&\n' span_id:763) (Token id:Id.Lit_Chars val:'\ttest_cmp alllf alllf2\n' span_id:764) ) } ) (C {(test_done)}) ] )