(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: { (SQ <'merge-recursive space options\n'> <'\n'> <'* [master] Clarify\n'> <' ! [remote] Remove cruft\n'> <'--\n'> <' + [remote] Remove cruft\n'> <'* [master] Clarify\n'> <'*+ [remote^] Initial revision\n'> <'* ok 1: setup\n'> ) } spids: [4] ) ] redirects: [] ) (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 left:<Id.Lit_VarLike 'SED_OPTIONS='> name:SED_OPTIONS) op: assign_op.Equal rhs: {<-b>} spids: [29] ) ] redirects: [] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands:[(C {<test_have_prereq>} {<GREP_STRIPS_CR>})]) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'GREP_OPTIONS='> name:GREP_OPTIONS) op: assign_op.Equal rhs: {<-U>} spids: [41] ) ] redirects: [] ) (C {<export>} {<GREP_OPTIONS>}) ] spids: [32 38] ) ] else_action: [] redirects: [] ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\tconflict_hunks () {\n'> <'\t\tsed $SED_OPTIONS -n -e "\n'> <'\t\t\t/^<<<</ b conflict\n'> <'\t\t\tb\n'> <'\t\t\t: conflict\n'> <'\t\t\tp\n'> <'\t\t\t/^>>>>/ b\n'> <'\t\t\tn\n'> <'\t\t\tb conflict\n'> <'\t\t" "$@"\n'> <'\t} &&\n'> <'\n'> <'\tcat <<-\\EOF >text.txt &&\n'> <'\t Hope, he says, cherishes the soul of him who lives in\n'> <'\t justice and holiness and is the nurse of his age and the\n'> <'\t companion of his journey;--hope which is mightiest to sway\n'> <'\t the restless soul of man.\n'> <'\n'> <'\tHow admirable are his words! And the great blessing of riches, I do\n'> <'\tnot say to every man, but to a good man, is, that he has had no\n'> <'\toccasion to deceive or to defraud others, either intentionally or\n'> <'\tunintentionally; and when he departs to the world below he is not in\n'> <'\tany apprehension about offerings due to the gods or debts which he owes\n'> <'\tto men. Now to this peace of mind the possession of wealth greatly\n'> <'\tcontributes; and therefore I say, that, setting one thing against\n'> <'\tanother, of the many advantages which wealth has to give, to a man of\n'> <'\tsense this is in my opinion the greatest.\n'> <'\n'> <'\tWell said, Cephalus, I replied; but as concerning justice, what is\n'> <'\tit?--to speak the truth and to pay your debts--no more than this? And\n'> <'\teven to this are there not exceptions? Suppose that a friend when in\n'> <'\this right mind has deposited arms with me and he asks for them when he\n'> <'\tis not in his right mind, ought I to give them back to him? No one\n'> <'\twould say that I ought or that I should be right in doing so, any more\n'> <'\tthan they would say that I ought always to speak the truth to one who\n'> <'\tis in his condition.\n'> <'\n'> <'\tYou are quite right, he replied.\n'> <'\n'> <'\tBut then, I said, speaking the truth and paying your debts is not a\n'> <'\tcorrect definition of justice.\n'> <'\n'> <'\tCEPHALUS - SOCRATES - POLEMARCHUS\n'> <'\n'> <'\tQuite correct, Socrates, if Simonides is to be believed, said\n'> <'\tPolemarchus interposing.\n'> <'\n'> <'\tI fear, said Cephalus, that I must go now, for I have to look after the\n'> <'\tsacrifices, and I hand over the argument to Polemarchus and the company.\n'> <'\tEOF\n'> <'\tgit add text.txt &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "Initial revision" &&\n'> <'\n'> <'\tgit checkout -b remote &&\n'> <'\tsed -e "\n'> <'\t\t\ts/\\. /\\. /g\n'> <'\t\t\ts/[?] /? /g\n'> <'\t\t\ts/ /\t/g\n'> <'\t\t\ts/--/---/g\n'> <'\t\t\ts/but as concerning/but as con cerning/\n'> <'\t\t\t/CEPHALUS - SOCRATES - POLEMARCHUS/ d\n'> <'\t\t" text.txt >text.txt+ &&\n'> <'\tmv text.txt+ text.txt &&\n'> <'\tgit commit -a -m "Remove cruft" &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\tsed -e "\n'> <'\t\t\ts/\\(not in his right mind\\),\\(.*\\)/\\1;\\2Q/\n'> <'\t\t\ts/Quite correct\\(.*\\)/It is too correct\\1Q/\n'> <'\t\t\ts/unintentionally/un intentionally/\n'> <'\t\t\t/un intentionally/ s/$/Q/\n'> <'\t\t\ts/Polemarchus interposing./Polemarchus, interposing.Q/\n'> <'\t\t\t/justice and holiness/ s/$/Q/\n'> <'\t\t\t/pay your debts/ s/$/Q/\n'> <'\t\t" text.txt | q_to_cr >text.txt+ &&\n'> <'\tmv text.txt+ text.txt &&\n'> <'\tgit commit -a -m "Clarify" &&\n'> <'\tgit show-branch --all\n'> ) } ) (C {<test_expect_success>} {(SQ <'naive merge fails'>)} { (SQ <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\ttest_must_fail git merge-recursive HEAD^ -- HEAD remote &&\n'> <'\ttest_must_fail git update-index --refresh &&\n'> <'\tgrep "<<<<<<" text.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'--ignore-space-change makes merge succeed'>)} { (SQ <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\tgit merge-recursive --ignore-space-change HEAD^ -- HEAD remote\n'> ) } ) (C {<test_expect_success>} {(SQ <'naive cherry-pick fails'>)} { (SQ <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\ttest_must_fail git cherry-pick --no-commit remote &&\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\ttest_must_fail git cherry-pick remote &&\n'> <'\ttest_must_fail git update-index --refresh &&\n'> <'\tgrep "<<<<<<" text.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'-Xignore-space-change makes cherry-pick succeed'>)} { (SQ <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\tgit cherry-pick --no-commit -Xignore-space-change remote\n'> ) } ) (C {<test_expect_success>} {(SQ <'--ignore-space-change: our w/s-only change wins'>)} { (SQ <'\n'> <'\tq_to_cr <<-\\EOF >expected &&\n'> <'\t justice and holiness and is the nurse of his age and theQ\n'> <'\tEOF\n'> <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\tgit merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&\n'> <'\tgrep "justice and holiness" text.txt >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--ignore-space-change: their real change wins over w/s'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tit?---to speak the truth and to pay your debts---no more than this? And\n'> <'\tEOF\n'> <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\tgit merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&\n'> <'\tgrep "pay your debts" text.txt >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--ignore-space-change: does not ignore new spaces'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >expected1 &&\n'> <'\tWell said, Cephalus, I replied; but as con cerning justice, what is\n'> <'\tEOF\n'> <'\tq_to_cr <<-\\EOF >expected2 &&\n'> <'\tun intentionally; and when he departs to the world below he is not inQ\n'> <'\tEOF\n'> <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\tgit merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&\n'> <'\tgrep "Well said" text.txt >actual1 &&\n'> <'\tgrep "when he departs" text.txt >actual2 &&\n'> <'\ttest_cmp expected1 actual1 &&\n'> <'\ttest_cmp expected2 actual2\n'> ) } ) (C {<test_expect_success>} {(SQ <'--ignore-all-space drops their new spaces'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tWell said, Cephalus, I replied; but as concerning justice, what is\n'> <'\tEOF\n'> <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\tgit merge-recursive --ignore-all-space HEAD^ -- HEAD remote &&\n'> <'\tgrep "Well said" text.txt >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--ignore-all-space keeps our new spaces'>)} { (SQ <'\n'> <'\tq_to_cr <<-\\EOF >expected &&\n'> <'\tun intentionally; and when he departs to the world below he is not inQ\n'> <'\tEOF\n'> <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\tgit merge-recursive --ignore-all-space HEAD^ -- HEAD remote &&\n'> <'\tgrep "when he departs" text.txt >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <--ignore-space-at-eol>)} { (SQ <'\n'> <'\tq_to_cr <<-\\EOF >expected &&\n'> <'\t<<<<<<< HEAD\n'> <'\tis not in his right mind; ought I to give them back to him? No oneQ\n'> <'\t=======\n'> <'\tis not in his right mind, ought I to give them back to him? No one\n'> <'\t>>>>>>> remote\n'> <'\tEOF\n'> <'\n'> <'\tgit read-tree --reset -u HEAD &&\n'> <'\ttest_must_fail git merge-recursive --ignore-space-at-eol \\\n'> <'\t\t\t\t\t\t HEAD^ -- HEAD remote &&\n'> <'\tconflict_hunks text.txt >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_done>}) ] )