(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"CRLF conversion">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: has_cr body: (BraceGroup children: [ (Pipeline children: [ (SimpleCommand words: [{(tr)} {(SQ <"\\015">)} {(Q)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Number "$1"))} spids: [30] ) ] ) (SimpleCommand words: [{(grep)} {(Q)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[41])] ) ] negated: False ) ] spids: [19] ) spids: [15 18] ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\n"> <"\tgit config core.autocrlf false &&\n"> <"\n"> <"\tfor w in Hello world how are you; do echo $w; done >LFonly &&\n"> <"\tfor w in I am very very fine thank you; do echo ${w}Q; done | q_to_cr >CRLFonly &&\n"> < "\tfor w in Oh here is a QNUL byte how alarming; do echo ${w}; done | q_to_nul >LFwithNUL &&\n" > <"\tgit add . &&\n"> <"\n"> <"\tgit commit -m initial &&\n"> <"\n"> <"\tLFonly=$(git rev-parse HEAD:LFonly) &&\n"> <"\tCRLFonly=$(git rev-parse HEAD:CRLFonly) &&\n"> <"\tLFwithNUL=$(git rev-parse HEAD:LFwithNUL) &&\n"> <"\n"> <"\techo happy.\n"> ) } ) (C {(test_expect_success)} {(SQ <"default settings cause no changes">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\t! has_cr LFonly &&\n"> <"\thas_cr CRLFonly &&\n"> <"\tLFonlydiff=$(git diff LFonly) &&\n"> <"\tCRLFonlydiff=$(git diff CRLFonly) &&\n"> <"\tLFwithNULdiff=$(git diff LFwithNUL) &&\n"> <"\ttest -z \"$LFonlydiff\" -a -z \"$CRLFonlydiff\" -a -z \"$LFwithNULdiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"crlf=true causes a CRLF file to be normalized">)} { (SQ <"\n"> <"\n"> <"\t# Backwards compatibility check\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\techo \"CRLFonly crlf\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\t# Note, \"normalized\" means that git will normalize it if added\n"> <"\thas_cr CRLFonly &&\n"> <"\tCRLFonlydiff=$(git diff CRLFonly) &&\n"> <"\ttest -n \"$CRLFonlydiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"text=true causes a CRLF file to be normalized">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\techo \"CRLFonly text\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\t# Note, \"normalized\" means that git will normalize it if added\n"> <"\thas_cr CRLFonly &&\n"> <"\tCRLFonlydiff=$(git diff CRLFonly) &&\n"> <"\ttest -n \"$CRLFonlydiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"eol=crlf gives a normalized file CRLFs with autocrlf=false">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\tgit config core.autocrlf false &&\n"> <"\techo \"LFonly eol=crlf\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\thas_cr LFonly &&\n"> <"\tLFonlydiff=$(git diff LFonly) &&\n"> <"\ttest -z \"$LFonlydiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"eol=crlf gives a normalized file CRLFs with autocrlf=input">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\tgit config core.autocrlf input &&\n"> <"\techo \"LFonly eol=crlf\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\thas_cr LFonly &&\n"> <"\tLFonlydiff=$(git diff LFonly) &&\n"> <"\ttest -z \"$LFonlydiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"eol=lf gives a normalized file LFs with autocrlf=true">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\tgit config core.autocrlf true &&\n"> <"\techo \"LFonly eol=lf\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\t! has_cr LFonly &&\n"> <"\tLFonlydiff=$(git diff LFonly) &&\n"> <"\ttest -z \"$LFonlydiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"autocrlf=true does not normalize CRLF files">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\tgit config core.autocrlf true &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\thas_cr LFonly &&\n"> <"\thas_cr CRLFonly &&\n"> <"\tLFonlydiff=$(git diff LFonly) &&\n"> <"\tCRLFonlydiff=$(git diff CRLFonly) &&\n"> <"\tLFwithNULdiff=$(git diff LFwithNUL) &&\n"> <"\ttest -z \"$LFonlydiff\" -a -z \"$CRLFonlydiff\" -a -z \"$LFwithNULdiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"text=auto, autocrlf=true does not normalize CRLF files">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\tgit config core.autocrlf true &&\n"> <"\techo \"* text=auto\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\thas_cr LFonly &&\n"> <"\thas_cr CRLFonly &&\n"> <"\tLFonlydiff=$(git diff LFonly) &&\n"> <"\tCRLFonlydiff=$(git diff CRLFonly) &&\n"> <"\tLFwithNULdiff=$(git diff LFwithNUL) &&\n"> <"\ttest -z \"$LFonlydiff\" -a -z \"$CRLFonlydiff\" -a -z \"$LFwithNULdiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"text=auto, autocrlf=true does not normalize binary files">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\tgit config core.autocrlf true &&\n"> <"\techo \"* text=auto\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\t! has_cr LFwithNUL &&\n"> <"\tLFwithNULdiff=$(git diff LFwithNUL) &&\n"> <"\ttest -z \"$LFwithNULdiff\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"eol=crlf _does_ normalize binary files">)} { (SQ <"\n"> <"\n"> <"\trm -f .gitattributes tmp LFonly CRLFonly LFwithNUL &&\n"> <"\techo \"LFwithNUL eol=crlf\" > .gitattributes &&\n"> <"\tgit read-tree --reset -u HEAD &&\n"> <"\n"> <"\thas_cr LFwithNUL &&\n"> <"\tLFwithNULdiff=$(git diff LFwithNUL) &&\n"> <"\ttest -z \"$LFwithNULdiff\"\n"> ) } ) (C {(test_done)}) ] )