(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) 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] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (AndOr children: [ (C {(test_have_prereq)} {(SED_STRIPS_CR)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SED_OPTIONS) op:Equal rhs:{(-b)} spids:[29])] spids: [29] ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [(C {(test_have_prereq)} {(GREP_STRIPS_CR)})] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GREP_OPTIONS) op:Equal rhs:{(-U)} spids:[41])] spids: [41] ) (C {(export)} {(GREP_OPTIONS)}) ] spids: [-1 38] ) ] spids: [-1 49] ) (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)}) ] )