3 test_description='merge-recursive options
6 ! [remote] Remove cruft
8 + [remote] Remove cruft
10 *+ [remote^] Initial revision
16 test_expect_success 'setup' '
29 cat <<-\EOF >text.txt &&
30 Hope, he says, cherishes the soul of him who lives in
31 justice and holiness and is the nurse of his age and the
32 companion of his journey;--hope which is mightiest to sway
33 the restless soul of man.
35 How admirable are his words! And the great blessing of riches, I do
36 not say to every man, but to a good man, is, that he has had no
37 occasion to deceive or to defraud others, either intentionally or
38 unintentionally; and when he departs to the world below he is not in
39 any apprehension about offerings due to the gods or debts which he owes
40 to men. Now to this peace of mind the possession of wealth greatly
41 contributes; and therefore I say, that, setting one thing against
42 another, of the many advantages which wealth has to give, to a man of
43 sense this is in my opinion the greatest.
45 Well said, Cephalus, I replied; but as concerning justice, what is
46 it?--to speak the truth and to pay your debts--no more than this? And
47 even to this are there not exceptions? Suppose that a friend when in
48 his right mind has deposited arms with me and he asks for them when he
49 is not in his right mind, ought I to give them back to him? No one
50 would say that I ought or that I should be right in doing so, any more
51 than they would say that I ought always to speak the truth to one who
54 You are quite right, he replied.
56 But then, I said, speaking the truth and paying your debts is not a
57 correct definition of justice.
59 CEPHALUS - SOCRATES - POLEMARCHUS
61 Quite correct, Socrates, if Simonides is to be believed, said
62 Polemarchus interposing.
64 I fear, said Cephalus, that I must go now, for I have to look after the
65 sacrifices, and I hand over the argument to Polemarchus and the company.
69 git commit -m "Initial revision" &&
71 git checkout -b remote &&
77 s/but as concerning/but as con cerning/
78 /CEPHALUS - SOCRATES - POLEMARCHUS/ d
79 " text.txt >text.txt+ &&
80 mv text.txt+ text.txt &&
81 git commit -a -m "Remove cruft" &&
83 git checkout master &&
85 s/\(not in his right mind\),\(.*\)/\1;\2Q/
86 s/Quite correct\(.*\)/It is too correct\1Q/
87 s/unintentionally/un intentionally/
88 /un intentionally/ s/$/Q/
89 s/Polemarchus interposing./Polemarchus, interposing.Q/
90 /justice and holiness/ s/$/Q/
91 /pay your debts/ s/$/Q/
92 " text.txt | q_to_cr >text.txt+ &&
93 mv text.txt+ text.txt &&
94 git commit -a -m "Clarify" &&
98 test_expect_success 'naive merge fails' '
99 git read-tree --reset -u HEAD &&
100 test_must_fail git merge-recursive HEAD^ -- HEAD remote &&
101 test_must_fail git update-index --refresh &&
102 grep "<<<<<<" text.txt
105 test_expect_success '--ignore-space-change makes merge succeed' '
106 git read-tree --reset -u HEAD &&
107 git merge-recursive --ignore-space-change HEAD^ -- HEAD remote
110 test_expect_success 'naive cherry-pick fails' '
111 git read-tree --reset -u HEAD &&
112 test_must_fail git cherry-pick --no-commit remote &&
113 git read-tree --reset -u HEAD &&
114 test_must_fail git cherry-pick remote &&
115 test_must_fail git update-index --refresh &&
116 grep "<<<<<<" text.txt
119 test_expect_success '-Xignore-space-change makes cherry-pick succeed' '
120 git read-tree --reset -u HEAD &&
121 git cherry-pick --no-commit -Xignore-space-change remote
124 test_expect_success '--ignore-space-change: our w/s-only change wins' '
125 q_to_cr <<-\EOF >expected &&
126 justice and holiness and is the nurse of his age and theQ
129 git read-tree --reset -u HEAD &&
130 git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
131 grep "justice and holiness" text.txt >actual &&
132 test_cmp expected actual
135 test_expect_success '--ignore-space-change: their real change wins over w/s' '
136 cat <<-\EOF >expected &&
137 it?---to speak the truth and to pay your debts---no more than this? And
140 git read-tree --reset -u HEAD &&
141 git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
142 grep "pay your debts" text.txt >actual &&
143 test_cmp expected actual
146 test_expect_success '--ignore-space-change: does not ignore new spaces' '
147 cat <<-\EOF >expected1 &&
148 Well said, Cephalus, I replied; but as con cerning justice, what is
150 q_to_cr <<-\EOF >expected2 &&
151 un intentionally; and when he departs to the world below he is not inQ
154 git read-tree --reset -u HEAD &&
155 git merge-recursive --ignore-space-change HEAD^ -- HEAD remote &&
156 grep "Well said" text.txt >actual1 &&
157 grep "when he departs" text.txt >actual2 &&
158 test_cmp expected1 actual1 &&
159 test_cmp expected2 actual2
162 test_expect_success '--ignore-all-space drops their new spaces' '
163 cat <<-\EOF >expected &&
164 Well said, Cephalus, I replied; but as concerning justice, what is
167 git read-tree --reset -u HEAD &&
168 git merge-recursive --ignore-all-space HEAD^ -- HEAD remote &&
169 grep "Well said" text.txt >actual &&
170 test_cmp expected actual
173 test_expect_success '--ignore-all-space keeps our new spaces' '
174 q_to_cr <<-\EOF >expected &&
175 un intentionally; and when he departs to the world below he is not inQ
178 git read-tree --reset -u HEAD &&
179 git merge-recursive --ignore-all-space HEAD^ -- HEAD remote &&
180 grep "when he departs" text.txt >actual &&
181 test_cmp expected actual
184 test_expect_success '--ignore-space-at-eol' '
185 q_to_cr <<-\EOF >expected &&
187 is not in his right mind; ought I to give them back to him? No oneQ
189 is not in his right mind, ought I to give them back to him? No one
193 git read-tree --reset -u HEAD &&
194 test_must_fail git merge-recursive --ignore-space-at-eol \
195 HEAD^ -- HEAD remote &&
196 conflict_hunks text.txt >actual &&
197 test_cmp expected actual