Skip to content

Commit 5caab8d

Browse files
Denton-Lgitster
authored andcommitted
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>
1 parent b510f0b commit 5caab8d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

t/t3507-cherry-pick-conflict.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ test_expect_success 'cherry-pick --no-commit does not set CHERRY_PICK_HEAD' '
8888

8989
test_expect_success 'cherry-pick w/dirty tree does not set CHERRY_PICK_HEAD' '
9090
pristine_detach initial &&
91-
echo foo > foo &&
91+
echo foo >foo &&
9292
test_must_fail git cherry-pick base &&
9393
test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
9494
'
9595

9696
test_expect_success \
9797
'cherry-pick --strategy=resolve w/dirty tree does not set CHERRY_PICK_HEAD' '
9898
pristine_detach initial &&
99-
echo foo > foo &&
99+
echo foo >foo &&
100100
test_must_fail git cherry-pick --strategy=resolve base &&
101101
test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
102102
'
@@ -175,23 +175,23 @@ test_expect_success 'failed cherry-pick registers participants in index' '
175175
git ls-files --stage foo &&
176176
git checkout picked -- foo &&
177177
git ls-files --stage foo
178-
} > stages &&
178+
} >stages &&
179179
sed "
180180
1 s/ 0 / 1 /
181181
2 s/ 0 / 2 /
182182
3 s/ 0 / 3 /
183-
" < stages > expected &&
183+
" stages >expected &&
184184
git read-tree -u --reset HEAD &&
185185
186186
test_must_fail git cherry-pick picked &&
187-
git ls-files --stage --unmerged > actual &&
187+
git ls-files --stage --unmerged >actual &&
188188
189189
test_cmp expected actual
190190
'
191191

192192
test_expect_success 'failed cherry-pick describes conflict in work tree' '
193193
pristine_detach initial &&
194-
cat <<-EOF > expected &&
194+
cat <<-EOF >expected &&
195195
<<<<<<< HEAD
196196
a
197197
=======
@@ -201,14 +201,14 @@ test_expect_success 'failed cherry-pick describes conflict in work tree' '
201201
202202
test_must_fail git cherry-pick picked &&
203203
204-
sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
204+
sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
205205
test_cmp expected actual
206206
'
207207

208208
test_expect_success 'diff3 -m style' '
209209
pristine_detach initial &&
210210
git config merge.conflictstyle diff3 &&
211-
cat <<-EOF > expected &&
211+
cat <<-EOF >expected &&
212212
<<<<<<< HEAD
213213
a
214214
||||||| parent of objid picked
@@ -220,14 +220,14 @@ test_expect_success 'diff3 -m style' '
220220
221221
test_must_fail git cherry-pick picked &&
222222
223-
sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
223+
sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
224224
test_cmp expected actual
225225
'
226226

227227
test_expect_success 'revert also handles conflicts sanely' '
228228
git config --unset merge.conflictstyle &&
229229
pristine_detach initial &&
230-
cat <<-EOF > expected &&
230+
cat <<-EOF >expected &&
231231
<<<<<<< HEAD
232232
a
233233
=======
@@ -241,24 +241,24 @@ test_expect_success 'revert also handles conflicts sanely' '
241241
git ls-files --stage foo &&
242242
git checkout base -- foo &&
243243
git ls-files --stage foo
244-
} > stages &&
244+
} >stages &&
245245
sed "
246246
1 s/ 0 / 1 /
247247
2 s/ 0 / 2 /
248248
3 s/ 0 / 3 /
249-
" < stages > expected-stages &&
249+
" stages >expected-stages &&
250250
git read-tree -u --reset HEAD &&
251251
252252
head=$(git rev-parse HEAD) &&
253253
test_must_fail git revert picked &&
254254
newhead=$(git rev-parse HEAD) &&
255-
git ls-files --stage --unmerged > actual-stages &&
255+
git ls-files --stage --unmerged >actual-stages &&
256256
257257
test "$head" = "$newhead" &&
258258
test_must_fail git update-index --refresh -q &&
259259
test_must_fail git diff-index --exit-code HEAD &&
260260
test_cmp expected-stages actual-stages &&
261-
sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
261+
sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
262262
test_cmp expected actual
263263
'
264264

@@ -284,7 +284,7 @@ test_expect_success 'revert --no-commit sets REVERT_HEAD' '
284284

285285
test_expect_success 'revert w/dirty tree does not set REVERT_HEAD' '
286286
pristine_detach base &&
287-
echo foo > foo &&
287+
echo foo >foo &&
288288
test_must_fail git revert base &&
289289
test_must_fail git rev-parse --verify CHERRY_PICK_HEAD &&
290290
test_must_fail git rev-parse --verify REVERT_HEAD
@@ -319,7 +319,7 @@ test_expect_success 'failed commit does not clear REVERT_HEAD' '
319319
test_expect_success 'revert conflict, diff3 -m style' '
320320
pristine_detach initial &&
321321
git config merge.conflictstyle diff3 &&
322-
cat <<-EOF > expected &&
322+
cat <<-EOF >expected &&
323323
<<<<<<< HEAD
324324
a
325325
||||||| objid picked
@@ -331,7 +331,7 @@ test_expect_success 'revert conflict, diff3 -m style' '
331331
332332
test_must_fail git revert picked &&
333333
334-
sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
334+
sed "s/[a-f0-9]*\.\.\./objid/" foo >actual &&
335335
test_cmp expected actual
336336
'
337337

@@ -345,7 +345,7 @@ test_expect_success 'commit after failed cherry-pick does not add duplicated -s'
345345
pristine_detach initial &&
346346
test_must_fail git cherry-pick -s picked-signed &&
347347
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
349349
'
350350

351351
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'
359359
Signed-off-by: C O Mitter <committer@example.com>
360360
# Conflicts:
361361
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 &&
363363
test_cmp expect actual &&
364364
365365
cat <<-\EOF >expected &&
@@ -378,7 +378,7 @@ test_expect_success 'commit --amend -s places the sign-off at the right place' '
378378
379379
# emulate old-style conflicts block
380380
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 &&
382382
383383
git commit -a &&
384384
git commit --amend -s &&
@@ -388,7 +388,7 @@ test_expect_success 'commit --amend -s places the sign-off at the right place' '
388388
Signed-off-by: C O Mitter <committer@example.com>
389389
Conflicts:
390390
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 &&
392392
test_cmp expect actual
393393
'
394394

0 commit comments

Comments
 (0)