t3404: modernize here doc style
In 't3404-rebase-interactive.sh' the expected output of several tests is prepared from here documents, which are outside of 'test_expect_success' blocks and have spaces around redirection operators. Move these here documents into the corresponding 'test_expect_success' block and avoid spaces between filename and redition operators. Furthermore, quote the here docs' delimiter word to prevent parameter expansions and what not, where applicable. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Jun 24, 2019 at 20:13 UTC
c9749b369da14cbac6201b1730586abf1f3974f6
1 file changed
+58
-65
t/t3404-rebase-interactive.sh
+58
-65
@@ -75,11 +75,10 @@ test_expect_success 'rebase --keep-empty' '
75
test_line_count = 6 actual
76
'
77
78
-cat > expect <<EOF
79
-error: nothing to do
80
-EOF
81
-
78
test_expect_success 'rebase -i with empty HEAD' '
79
+ cat >expect <<-\EOF &&
80
+ error: nothing to do
81
+ EOF
82
set_fake_editor &&
83
test_must_fail env FAKE_LINES="1 exec_true" git rebase -i HEAD^ >actual 2>&1 &&
84
test_i18ncmp expect actual
@@ -237,25 +236,23 @@ test_expect_success 'exchange two commits' '
236
test G = $(git cat-file commit HEAD | sed -ne \$p)
237
'
238
240
-cat > expect << EOF
241
-diff --git a/file1 b/file1
242
-index f70f10e..fd79235 100644
243
---- a/file1
244
-+++ b/file1
245
-@@ -1 +1 @@
246
--A
247
-+G
248
-EOF
249
-
250
-cat > expect2 << EOF
251
-<<<<<<< HEAD
252
-D
253
-=======
254
-G
255
->>>>>>> 5d18e54... G
256
-EOF
257
-
239
test_expect_success 'stop on conflicting pick' '
240
+ cat >expect <<-\EOF &&
241
+ diff --git a/file1 b/file1
242
+ index f70f10e..fd79235 100644
243
+ --- a/file1
244
+ +++ b/file1
245
+ @@ -1 +1 @@
246
+ -A
247
+ +G
248
+ EOF
249
+ cat >expect2 <<-\EOF &&
250
+ <<<<<<< HEAD
251
+ D
252
+ =======
253
+ G
254
+ >>>>>>> 5d18e54... G
255
+ EOF
256
git tag new-branch1 &&
257
set_fake_editor &&
258
test_must_fail git rebase -i master &&
@@ -495,15 +492,14 @@ test_expect_success 'commit message retained after conflict' '
492
git branch -D conflict-squash
493
'
494
498
-cat > expect-squash-fixup << EOF
499
-B
500
-
501
-D
495
+test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
496
+ cat >expect-squash-fixup <<-\EOF &&
497
+ B
498
503
-ONCE
504
-EOF
499
+ D
500
506
-test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
501
+ ONCE
502
+ EOF
503
git checkout -b squash-fixup E &&
504
base=$(git rev-parse HEAD~4) &&
505
set_fake_editor &&
@@ -799,13 +795,12 @@ test_expect_success 'rebase -i can copy notes' '
795
test "a note" = "$(git notes show HEAD)"
796
'
797
802
-cat >expect <<EOF
803
-an earlier note
804
-
805
-a note
806
-EOF
807
-
798
test_expect_success 'rebase -i can copy notes over a fixup' '
799
+ cat >expect <<-\EOF &&
800
+ an earlier note
801
+
802
+ a note
803
+ EOF
804
git reset --hard n3 &&
805
git notes add -m"an earlier note" n2 &&
806
set_fake_editor &&
@@ -1304,27 +1299,26 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
1299
actual
1300
'
1301
1307
-cat >expect <<EOF
1308
-Warning: some commits may have been dropped accidentally.
1309
-Dropped commits (newer to older):
1310
- - $(git rev-list --pretty=oneline --abbrev-commit -1 master)
1311
-To avoid this message, use "drop" to explicitly remove a commit.
1312
-
1313
-Use 'git config rebase.missingCommitsCheck' to change the level of warnings.
1314
-The possible behaviours are: ignore, warn, error.
1315
-
1316
-Rebasing (1/4)
1317
-Rebasing (2/4)
1318
-Rebasing (3/4)
1319
-Rebasing (4/4)
1320
-Successfully rebased and updated refs/heads/missing-commit.
1321
-EOF
1322
-
1302
cr_to_nl () {
1303
tr '\015' '\012'
1304
}
1305
1306
test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
1307
+ cat >expect <<-EOF &&
1308
+ Warning: some commits may have been dropped accidentally.
1309
+ Dropped commits (newer to older):
1310
+ - $(git rev-list --pretty=oneline --abbrev-commit -1 master)
1311
+ To avoid this message, use "drop" to explicitly remove a commit.
1312
+
1313
+ Use '\''git config rebase.missingCommitsCheck'\'' to change the level of warnings.
1314
+ The possible behaviours are: ignore, warn, error.
1315
+
1316
+ Rebasing (1/4)
1317
+ Rebasing (2/4)
1318
+ Rebasing (3/4)
1319
+ Rebasing (4/4)
1320
+ Successfully rebased and updated refs/heads/missing-commit.
1321
+ EOF
1322
test_config rebase.missingCommitsCheck warn &&
1323
rebase_setup_and_clean missing-commit &&
1324
set_fake_editor &&
@@ -1335,21 +1329,20 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
1329
test D = $(git cat-file commit HEAD | sed -ne \$p)
1330
'
1331
1338
-cat >expect <<EOF
1339
-Warning: some commits may have been dropped accidentally.
1340
-Dropped commits (newer to older):
1341
- - $(git rev-list --pretty=oneline --abbrev-commit -1 master)
1342
- - $(git rev-list --pretty=oneline --abbrev-commit -1 master~2)
1343
-To avoid this message, use "drop" to explicitly remove a commit.
1344
-
1345
-Use 'git config rebase.missingCommitsCheck' to change the level of warnings.
1346
-The possible behaviours are: ignore, warn, error.
1347
-
1348
-You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.
1349
-Or you can abort the rebase with 'git rebase --abort'.
1350
-EOF
1351
-
1332
test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
1333
+ cat >expect <<-EOF &&
1334
+ Warning: some commits may have been dropped accidentally.
1335
+ Dropped commits (newer to older):
1336
+ - $(git rev-list --pretty=oneline --abbrev-commit -1 master)
1337
+ - $(git rev-list --pretty=oneline --abbrev-commit -1 master~2)
1338
+ To avoid this message, use "drop" to explicitly remove a commit.
1339
+
1340
+ Use '\''git config rebase.missingCommitsCheck'\'' to change the level of warnings.
1341
+ The possible behaviours are: ignore, warn, error.
1342
+
1343
+ You can fix this with '\''git rebase --edit-todo'\'' and then run '\''git rebase --continue'\''.
1344
+ Or you can abort the rebase with '\''git rebase --abort'\''.
1345
+ EOF
1346
test_config rebase.missingCommitsCheck error &&
1347
rebase_setup_and_clean missing-commit &&
1348
set_fake_editor &&