Skip to content

Commit c9749b3

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b697d92 commit c9749b3

File tree

1 file changed

+58
-65
lines changed

1 file changed

+58
-65
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 58 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ test_expect_success 'rebase --keep-empty' '
7575
test_line_count = 6 actual
7676
'
7777

78-
cat > expect <<EOF
79-
error: nothing to do
80-
EOF
81-
8278
test_expect_success 'rebase -i with empty HEAD' '
79+
cat >expect <<-\EOF &&
80+
error: nothing to do
81+
EOF
8382
set_fake_editor &&
8483
test_must_fail env FAKE_LINES="1 exec_true" git rebase -i HEAD^ >actual 2>&1 &&
8584
test_i18ncmp expect actual
@@ -237,25 +236,23 @@ test_expect_success 'exchange two commits' '
237236
test G = $(git cat-file commit HEAD | sed -ne \$p)
238237
'
239238

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-
258239
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
259256
git tag new-branch1 &&
260257
set_fake_editor &&
261258
test_must_fail git rebase -i master &&
@@ -495,15 +492,14 @@ test_expect_success 'commit message retained after conflict' '
495492
git branch -D conflict-squash
496493
'
497494

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
502498
503-
ONCE
504-
EOF
499+
D
505500
506-
test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
501+
ONCE
502+
EOF
507503
git checkout -b squash-fixup E &&
508504
base=$(git rev-parse HEAD~4) &&
509505
set_fake_editor &&
@@ -799,13 +795,12 @@ test_expect_success 'rebase -i can copy notes' '
799795
test "a note" = "$(git notes show HEAD)"
800796
'
801797

802-
cat >expect <<EOF
803-
an earlier note
804-
805-
a note
806-
EOF
807-
808798
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
809804
git reset --hard n3 &&
810805
git notes add -m"an earlier note" n2 &&
811806
set_fake_editor &&
@@ -1304,27 +1299,26 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
13041299
actual
13051300
'
13061301

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-
13231302
cr_to_nl () {
13241303
tr '\015' '\012'
13251304
}
13261305

13271306
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
13281322
test_config rebase.missingCommitsCheck warn &&
13291323
rebase_setup_and_clean missing-commit &&
13301324
set_fake_editor &&
@@ -1335,21 +1329,20 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
13351329
test D = $(git cat-file commit HEAD | sed -ne \$p)
13361330
'
13371331

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-
13521332
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
13531346
test_config rebase.missingCommitsCheck error &&
13541347
rebase_setup_and_clean missing-commit &&
13551348
set_fake_editor &&

0 commit comments

Comments
 (0)