t3404: make the 'rebase.missingCommitsCheck=ignore' test more focused
The test 'rebase -i respects rebase.missingCommitsCheck = warn' is mainly interested in the warning about the dropped commits, but it checks the whole output of 'git rebase', including progress lines and what not that are not at all relevant to 'rebase.missingCommitsCheck', but make it necessary to update this test whenever e.g. the way we show progress is updated (as it will happen in one of the later patches of this series). Modify the test to verify only the first four lines of 'git rebase's output that contain all the important lines, notably the line containing the "Warning:" itself and the oneline log of the dropped commit. 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
077b9798919ac2aa63600a1547f55f89b62b3b02
1 file changed
+1
-14
t/t3404-rebase-interactive.sh
+1
-14
@@ -1299,32 +1299,19 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
1299
actual
1300
'
1301
1302
-cr_to_nl () {
1303
- tr '\015' '\012'
1304
-}
1305
-
1302
test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
1303
cat >expect <<-EOF &&
1304
Warning: some commits may have been dropped accidentally.
1305
Dropped commits (newer to older):
1306
- $(git rev-list --pretty=oneline --abbrev-commit -1 master)
1307
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.
1308
EOF
1309
test_config rebase.missingCommitsCheck warn &&
1310
rebase_setup_and_clean missing-commit &&
1311
set_fake_editor &&
1312
FAKE_LINES="1 2 3 4" \
1313
git rebase -i --root 2>actual.2 &&
1327
- cr_to_nl <actual.2 >actual &&
1314
+ head -n4 actual.2 >actual &&
1315
test_i18ncmp expect actual &&
1316
test D = $(git cat-file commit HEAD | sed -ne \$p)
1317
'