t3507: clean up style

Remove space after redirection operators for style. Also, remove a git command which was upstream of a pipe. Finally, let grep and sed open their own input instead of letting the shell redirect the input. Helped-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Apr 17, 2019 at 11:23 UTC 5caab8de8a8861e977ffa6e66f2a5ebfe5b8e56c
1 file changed +21 -21
t/t3507-cherry-pick-conflict.sh
+21 -21
@@ -88,7 +88,7 @@ test_expect_success 'cherry-pick --no-commit does not set CHERRY_PICK_HEAD' '
88
89 test_expect_success 'cherry-pick w/dirty tree does not set CHERRY_PICK_HEAD' '
90 pristine_detach initial &&
91 - echo foo > foo &&
91 + echo foo >foo &&
92 test_must_fail git cherry-pick base &&
93 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
94 '
@@ -96,7 +96,7 @@ test_expect_success 'cherry-pick w/dirty tree does not set CHERRY_PICK_HEAD' '
96 test_expect_success \
97 'cherry-pick --strategy=resolve w/dirty tree does not set CHERRY_PICK_HEAD' '
98 pristine_detach initial &&
99 - echo foo > foo &&
99 + echo foo >foo &&
100 test_must_fail git cherry-pick --strategy=resolve base &&
101 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
102 '
@@ -175,23 +175,23 @@ test_expect_success 'failed cherry-pick registers participants in index' '
175 git ls-files --stage foo &&
176 git checkout picked -- foo &&
177 git ls-files --stage foo
178 - } > stages &&
178 + } >stages &&
179 sed "
180 1 s/ 0 / 1 /
181 2 s/ 0 / 2 /
182 3 s/ 0 / 3 /
183 - " < stages > expected &&
183 + " stages >expected &&
184 git read-tree -u --reset HEAD &&
185
186 test_must_fail git cherry-pick picked &&
187 - git ls-files --stage --unmerged > actual &&
187 + git ls-files --stage --unmerged >actual &&
188
189 test_cmp expected actual
190 '
191
192 test_expect_success 'failed cherry-pick describes conflict in work tree' '
193 pristine_detach initial &&
194 - cat <<-EOF > expected &&
194 + cat <<-EOF >expected &&
195 <<<<<<< HEAD
196 a
197 =======
@@ -201,14 +201,14 @@ test_expect_success 'failed cherry-pick describes conflict in work tree' '
201
202 test_must_fail git cherry-pick picked &&
203
204 - sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
204 + sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
205 test_cmp expected actual
206 '
207
208 test_expect_success 'diff3 -m style' '
209 pristine_detach initial &&
210 git config merge.conflictstyle diff3 &&
211 - cat <<-EOF > expected &&
211 + cat <<-EOF >expected &&
212 <<<<<<< HEAD
213 a
214 ||||||| parent of objid picked
@@ -220,14 +220,14 @@ test_expect_success 'diff3 -m style' '
220
221 test_must_fail git cherry-pick picked &&
222
223 - sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
223 + sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
224 test_cmp expected actual
225 '
226
227 test_expect_success 'revert also handles conflicts sanely' '
228 git config --unset merge.conflictstyle &&
229 pristine_detach initial &&
230 - cat <<-EOF > expected &&
230 + cat <<-EOF >expected &&
231 <<<<<<< HEAD
232 a
233 =======
@@ -241,24 +241,24 @@ test_expect_success 'revert also handles conflicts sanely' '
241 git ls-files --stage foo &&
242 git checkout base -- foo &&
243 git ls-files --stage foo
244 - } > stages &&
244 + } >stages &&
245 sed "
246 1 s/ 0 / 1 /
247 2 s/ 0 / 2 /
248 3 s/ 0 / 3 /
249 - " < stages > expected-stages &&
249 + " stages >expected-stages &&
250 git read-tree -u --reset HEAD &&
251
252 head=$(git rev-parse HEAD) &&
253 test_must_fail git revert picked &&
254 newhead=$(git rev-parse HEAD) &&
255 - git ls-files --stage --unmerged > actual-stages &&
255 + git ls-files --stage --unmerged >actual-stages &&
256
257 test "$head" = "$newhead" &&
258 test_must_fail git update-index --refresh -q &&
259 test_must_fail git diff-index --exit-code HEAD &&
260 test_cmp expected-stages actual-stages &&
261 - sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
261 + sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
262 test_cmp expected actual
263 '
264
@@ -284,7 +284,7 @@ test_expect_success 'revert --no-commit sets REVERT_HEAD' '
284
285 test_expect_success 'revert w/dirty tree does not set REVERT_HEAD' '
286 pristine_detach base &&
287 - echo foo > foo &&
287 + echo foo >foo &&
288 test_must_fail git revert base &&
289 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD &&
290 test_must_fail git rev-parse --verify REVERT_HEAD
@@ -319,7 +319,7 @@ test_expect_success 'failed commit does not clear REVERT_HEAD' '
319 test_expect_success 'revert conflict, diff3 -m style' '
320 pristine_detach initial &&
321 git config merge.conflictstyle diff3 &&
322 - cat <<-EOF > expected &&
322 + cat <<-EOF >expected &&
323 <<<<<<< HEAD
324 a
325 ||||||| objid picked
@@ -331,7 +331,7 @@ test_expect_success 'revert conflict, diff3 -m style' '
331
332 test_must_fail git revert picked &&
333
334 - sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
334 + sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
335 test_cmp expected actual
336 '
337
@@ -345,7 +345,7 @@ test_expect_success 'commit after failed cherry-pick does not add duplicated -s'
345 pristine_detach initial &&
346 test_must_fail git cherry-pick -s picked-signed &&
347 git commit -a -s &&
348 - test $(git show -s |grep -c "Signed-off-by") = 1
348 + test $(git show -s >tmp && grep -c "Signed-off-by" tmp && rm tmp) = 1
349 '
350
351 test_expect_success 'commit after failed cherry-pick adds -s at the right place' '
@@ -359,7 +359,7 @@ test_expect_success 'commit after failed cherry-pick adds -s at the right place'
359 Signed-off-by: C O Mitter <committer@example.com>
360 # Conflicts:
361 EOF
362 - grep -e "^# Conflicts:" -e '^Signed-off-by' <.git/COMMIT_EDITMSG >actual &&
362 + grep -e "^# Conflicts:" -e '^Signed-off-by' .git/COMMIT_EDITMSG >actual &&
363 test_cmp expect actual &&
364
365 cat <<-\EOF >expected &&
@@ -378,7 +378,7 @@ test_expect_success 'commit --amend -s places the sign-off at the right place' '
378
379 # emulate old-style conflicts block
380 mv .git/MERGE_MSG .git/MERGE_MSG+ &&
381 - sed -e "/^# Conflicts:/,\$s/^# *//" <.git/MERGE_MSG+ >.git/MERGE_MSG &&
381 + sed -e "/^# Conflicts:/,\$s/^# *//" .git/MERGE_MSG+ >.git/MERGE_MSG &&
382
383 git commit -a &&
384 git commit --amend -s &&
@@ -388,7 +388,7 @@ test_expect_success 'commit --amend -s places the sign-off at the right place' '
388 Signed-off-by: C O Mitter <committer@example.com>
389 Conflicts:
390 EOF
391 - grep -e "^Conflicts:" -e '^Signed-off-by' <.git/COMMIT_EDITMSG >actual &&
391 + grep -e "^Conflicts:" -e '^Signed-off-by' .git/COMMIT_EDITMSG >actual &&
392 test_cmp expect actual
393 '
394