t3404: add test case for abbreviated commands

Make sure the todo list ends up using single-letter command abbreviations when the rebase.abbreviateCommands is enabled. This configuration option should not change anything else. Signed-off-by: Liam Beguin <liambeguin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Liam Beguin committed Dec 5, 2017 at 12:52 UTC 1795993488bef1b48e4224db096e9d12df075db2
1 file changed +22
t/t3404-rebase-interactive.sh
+22
@@ -1260,6 +1260,28 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
1260 test B = $(git cat-file commit HEAD^ | sed -ne \$p)
1261 '
1262
1263 +test_expect_success 'respects rebase.abbreviateCommands with fixup, squash and exec' '
1264 + rebase_setup_and_clean abbrevcmd &&
1265 + test_commit "first" file1.txt "first line" first &&
1266 + test_commit "second" file1.txt "another line" second &&
1267 + test_commit "fixup! first" file2.txt "first line again" first_fixup &&
1268 + test_commit "squash! second" file1.txt "another line here" second_squash &&
1269 + cat >expected <<-EOF &&
1270 + p $(git rev-list --abbrev-commit -1 first) first
1271 + f $(git rev-list --abbrev-commit -1 first_fixup) fixup! first
1272 + x git show HEAD
1273 + p $(git rev-list --abbrev-commit -1 second) second
1274 + s $(git rev-list --abbrev-commit -1 second_squash) squash! second
1275 + x git show HEAD
1276 + EOF
1277 + git checkout abbrevcmd &&
1278 + set_cat_todo_editor &&
1279 + test_config rebase.abbreviateCommands true &&
1280 + test_must_fail git rebase -i --exec "git show HEAD" \
1281 + --autosquash master >actual &&
1282 + test_cmp expected actual
1283 +'
1284 +
1285 test_expect_success 'static check of bad command' '
1286 rebase_setup_and_clean bad-cmd &&
1287 set_fake_editor &&