status: differentiate interactive from non-interactive rebases
[gitweb.git] / t / t3404-rebase-interactive.sh
index eed76cca55ce655cb51c793f21cd5ebbd363ba85..ac429a0bbbbeb95f96336aa203a5d9726ed6eb1d 100755 (executable)
@@ -1055,4 +1055,51 @@ test_expect_success 'todo count' '
        grep "^# Rebase ..* onto ..* ([0-9]" actual
 '
 
+test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '
+       git checkout --force branch2 &&
+       git clean -f &&
+       set_fake_editor &&
+       FAKE_LINES="edit 1 2" git rebase -i A &&
+       test_cmp_rev HEAD F &&
+       test_path_is_missing file6 &&
+       >file6 &&
+       test_must_fail git rebase --continue &&
+       test_cmp_rev HEAD F &&
+       rm file6 &&
+       git rebase --continue &&
+       test_cmp_rev HEAD I
+'
+
+test_expect_success 'rebase -i commits that overwrite untracked files (squash)' '
+       git checkout --force branch2 &&
+       git clean -f &&
+       git tag original-branch2 &&
+       set_fake_editor &&
+       FAKE_LINES="edit 1 squash 2" git rebase -i A &&
+       test_cmp_rev HEAD F &&
+       test_path_is_missing file6 &&
+       >file6 &&
+       test_must_fail git rebase --continue &&
+       test_cmp_rev HEAD F &&
+       rm file6 &&
+       git rebase --continue &&
+       test $(git cat-file commit HEAD | sed -ne \$p) = I &&
+       git reset --hard original-branch2
+'
+
+test_expect_success 'rebase -i commits that overwrite untracked files (no ff)' '
+       git checkout --force branch2 &&
+       git clean -f &&
+       set_fake_editor &&
+       FAKE_LINES="edit 1 2" git rebase -i --no-ff A &&
+       test $(git cat-file commit HEAD | sed -ne \$p) = F &&
+       test_path_is_missing file6 &&
+       >file6 &&
+       test_must_fail git rebase --continue &&
+       test $(git cat-file commit HEAD | sed -ne \$p) = F &&
+       rm file6 &&
+       git rebase --continue &&
+       test $(git cat-file commit HEAD | sed -ne \$p) = I
+'
+
 test_done