(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: { (SQ <'CRLF merge conflict across text=auto change\n'> <'\n'> <'* [master] remove .gitattributes\n'> <' ! [side] add line from b\n'> <'--\n'> <' + [side] add line from b\n'> <'* [master] remove .gitattributes\n'> <'* [master^] add line from a\n'> <'* [master~2] normalize file\n'> <'*+ [side^] Initial\n'> ) } spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test_have_prereq>} {<SED_STRIPS_CR>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SED_OPTIONS) op: assign_op.Equal rhs: {<-b>} spids: [30] ) ] ) ] ) (command.ShFunction name: compare_files body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<tr>} {(SQ <'\\015\\000'>)} {<QN>}] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_Number '$1'))} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_Number '$1')) <.expect>} ) ] do_fork: T ) (command.Simple words: [{<tr>} {(SQ <'\\015\\000'>)} {<QN>}] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_Number '$2'))} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_Number '$2')) <.actual>} ) ] do_fork: T ) (C {<test_cmp>} {(DQ ($ Id.VSub_Number '$1')) <.expect>} {(DQ ($ Id.VSub_Number '$2')) <.actual>} ) (C {<rm>} {(DQ ($ Id.VSub_Number '$1')) <.expect>} {(DQ ($ Id.VSub_Number '$2')) <.actual>} ) ] ) ] ) ) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\tgit config core.autocrlf false &&\n'> <'\n'> <'\techo first line | append_cr >file &&\n'> <'\techo first line >control_file &&\n'> <'\techo only line >inert_file &&\n'> <'\n'> <'\tgit add file control_file inert_file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "Initial" &&\n'> <'\tgit tag initial &&\n'> <'\tgit branch side &&\n'> <'\n'> <'\techo "* text=auto" >.gitattributes &&\n'> <'\techo first line >file &&\n'> <'\tgit add .gitattributes file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "normalize file" &&\n'> <'\n'> <'\techo same line | append_cr >>file &&\n'> <'\techo same line >>control_file &&\n'> <'\tgit add file control_file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "add line from a" &&\n'> <'\tgit tag a &&\n'> <'\n'> <'\tgit rm .gitattributes &&\n'> <'\trm file &&\n'> <'\tgit checkout file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "remove .gitattributes" &&\n'> <'\tgit tag c &&\n'> <'\n'> <'\tgit checkout side &&\n'> <'\techo same line | append_cr >>file &&\n'> <'\techo same line >>control_file &&\n'> <'\tgit add file control_file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "add line from b" &&\n'> <'\tgit tag b &&\n'> <'\n'> <'\tgit checkout master\n'> ) } ) (C {<test_expect_success>} {(SQ <'set up fuzz_conflict() helper'>)} { (SQ <'\n'> <'\tfuzz_conflict() {\n'> <'\t\tsed $SED_OPTIONS -e "s/^\\([<>=]......\\) .*/\\1/" "$@"\n'> <'\t}\n'> ) } ) (C {<test_expect_success>} {(SQ <'Merge after setting text=auto'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tfirst line\n'> <'\tsame line\n'> <'\tEOF\n'> <'\n'> <'\tif test_have_prereq NATIVE_CRLF; then\n'> <'\t\tappend_cr <expected >expected.temp &&\n'> <'\t\tmv expected.temp expected\n'> <'\tfi &&\n'> <'\tgit config merge.renormalize true &&\n'> <'\tgit rm -fr . &&\n'> <'\trm -f .gitattributes &&\n'> <'\tgit reset --hard a &&\n'> <'\tgit merge b &&\n'> <'\tcompare_files expected file\n'> ) } ) (C {<test_expect_success>} {(SQ <'Merge addition of text=auto eol=LF'>)} { (SQ <'\n'> <'\tgit config core.eol lf &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tfirst line\n'> <'\tsame line\n'> <'\tEOF\n'> <'\n'> <'\tgit config merge.renormalize true &&\n'> <'\tgit rm -fr . &&\n'> <'\trm -f .gitattributes &&\n'> <'\tgit reset --hard b &&\n'> <'\tgit merge a &&\n'> <'\tcompare_files expected file\n'> ) } ) (C {<test_expect_success>} {(SQ <'Merge addition of text=auto eol=CRLF'>)} { (SQ <'\n'> <'\tgit config core.eol crlf &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tfirst line\n'> <'\tsame line\n'> <'\tEOF\n'> <'\n'> <'\tappend_cr <expected >expected.temp &&\n'> <'\tmv expected.temp expected &&\n'> <'\tgit config merge.renormalize true &&\n'> <'\tgit rm -fr . &&\n'> <'\trm -f .gitattributes &&\n'> <'\tgit reset --hard b &&\n'> <'\techo >&2 "After git reset --hard b" &&\n'> <'\tgit ls-files -s --eol >&2 &&\n'> <'\tgit merge a &&\n'> <'\tcompare_files expected file\n'> ) } ) (C {<test_expect_success>} {(SQ <'Detect CRLF/LF conflict after setting text=auto'>)} { (SQ <'\n'> <'\tgit config core.eol native &&\n'> <'\techo "<<<<<<<" >expected &&\n'> <'\techo first line >>expected &&\n'> <'\techo same line >>expected &&\n'> <'\techo ======= >>expected &&\n'> <'\techo first line | append_cr >>expected &&\n'> <'\techo same line | append_cr >>expected &&\n'> <'\techo ">>>>>>>" >>expected &&\n'> <'\tgit config merge.renormalize false &&\n'> <'\trm -f .gitattributes &&\n'> <'\tgit reset --hard a &&\n'> <'\ttest_must_fail git merge b &&\n'> <'\tfuzz_conflict file >file.fuzzy &&\n'> <'\tcompare_files expected file.fuzzy\n'> ) } ) (C {<test_expect_success>} {(SQ <'Detect LF/CRLF conflict from addition of text=auto'>)} { (SQ <'\n'> <'\techo "<<<<<<<" >expected &&\n'> <'\techo first line | append_cr >>expected &&\n'> <'\techo same line | append_cr >>expected &&\n'> <'\techo ======= >>expected &&\n'> <'\techo first line >>expected &&\n'> <'\techo same line >>expected &&\n'> <'\techo ">>>>>>>" >>expected &&\n'> <'\tgit config merge.renormalize false &&\n'> <'\trm -f .gitattributes &&\n'> <'\tgit reset --hard b &&\n'> <'\ttest_must_fail git merge a &&\n'> <'\tfuzz_conflict file >file.fuzzy &&\n'> <'\tcompare_files expected file.fuzzy\n'> ) } ) (C {<test_expect_failure>} {(SQ <'checkout -m after setting text=auto'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tfirst line\n'> <'\tsame line\n'> <'\tEOF\n'> <'\n'> <'\tgit config merge.renormalize true &&\n'> <'\tgit rm -fr . &&\n'> <'\trm -f .gitattributes &&\n'> <'\tgit reset --hard initial &&\n'> <'\tgit checkout a -- . &&\n'> <'\tgit checkout -m b &&\n'> <'\tcompare_files expected file\n'> ) } ) (C {<test_expect_failure>} {(SQ <'checkout -m addition of text=auto'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tfirst line\n'> <'\tsame line\n'> <'\tEOF\n'> <'\n'> <'\tgit config merge.renormalize true &&\n'> <'\tgit rm -fr . &&\n'> <'\trm -f .gitattributes file &&\n'> <'\tgit reset --hard initial &&\n'> <'\tgit checkout b -- . &&\n'> <'\tgit checkout -m a &&\n'> <'\tcompare_files expected file\n'> ) } ) (C {<test_expect_failure>} {(SQ <'cherry-pick patch from after text=auto was added'>)} { (SQ <'\n'> <'\tappend_cr <<-\\EOF >expected &&\n'> <'\tfirst line\n'> <'\tsame line\n'> <'\tEOF\n'> <'\n'> <'\tgit config merge.renormalize true &&\n'> <'\tgit rm -fr . &&\n'> <'\tgit reset --hard b &&\n'> <'\ttest_must_fail git cherry-pick a >err 2>&1 &&\n'> <'\tgrep "[Nn]othing added" err &&\n'> <'\tcompare_files expected file\n'> ) } ) (C {<test_expect_success>} {(SQ <'Test delete/normalize conflict'>)} { (SQ <'\n'> <'\tgit checkout -f side &&\n'> <'\tgit rm -fr . &&\n'> <'\trm -f .gitattributes &&\n'> <'\tgit reset --hard initial &&\n'> <'\tgit rm file &&\n'> <'\tgit commit -m "remove file" &&\n'> <'\tgit checkout master &&\n'> <'\tgit reset --hard a^ &&\n'> <'\tgit merge side\n'> ) } ) (C {<test_done>}) ] )