rebase -i: demonstrate a bug with --autosquash
[gitweb.git] / t / t3415-rebase-autosquash.sh
index 8f53e54ce4176fd0697e8af60a105d40dc161a12..9b71a49f02962c6e0340b1d3616cb78d9f805c00 100755 (executable)
@@ -271,4 +271,28 @@ test_expect_success 'autosquash with custom inst format' '
        test 2 = $(git cat-file commit HEAD^ | grep squash | wc -l)
 '
 
+set_backup_editor () {
+       write_script backup-editor.sh <<-\EOF
+       cp "$1" .git/backup-"$(basename "$1")"
+       EOF
+       test_set_editor "$PWD/backup-editor.sh"
+}
+
+test_expect_failure 'autosquash with multiple empty patches' '
+       test_tick &&
+       git commit --allow-empty -m "empty" &&
+       test_tick &&
+       git commit --allow-empty -m "empty2" &&
+       test_tick &&
+       >fixup &&
+       git add fixup &&
+       git commit --fixup HEAD^^ &&
+       (
+               set_backup_editor &&
+               GIT_USE_REBASE_HELPER=false \
+               git rebase -i --force-rebase --autosquash HEAD~4 &&
+               grep empty2 .git/backup-git-rebase-todo
+       )
+'
+
 test_done