]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3404-rebase-interactive.sh
Merge branch 'jc/t3404-one-shot-export-fix'
[thirdparty/git.git] / t / t3404-rebase-interactive.sh
index 352a52e59d1a25d6fe50c5001ba3c84e2fc4a30c..01616901bdc868619fee8e28dce14649bd2661db 100755 (executable)
@@ -264,11 +264,18 @@ test_expect_success 'retain authorship' '
 '
 
 test_expect_success 'retain authorship w/ conflicts' '
+       oGIT_AUTHOR_NAME=$GIT_AUTHOR_NAME &&
+       test_when_finished "GIT_AUTHOR_NAME=\$oGIT_AUTHOR_NAME" &&
+
        git reset --hard twerp &&
        test_commit a conflict a conflict-a &&
        git reset --hard twerp &&
-       GIT_AUTHOR_NAME=AttributeMe \
+
+       GIT_AUTHOR_NAME=AttributeMe &&
+       export GIT_AUTHOR_NAME &&
        test_commit b conflict b conflict-b &&
+       GIT_AUTHOR_NAME=$oGIT_AUTHOR_NAME &&
+
        set_fake_editor &&
        test_must_fail git rebase -i conflict-a &&
        echo resolved >conflict &&
@@ -553,15 +560,16 @@ test_expect_success '--continue tries to commit, even for "edit"' '
 '
 
 test_expect_success 'aborted --continue does not squash commits after "edit"' '
+       test_when_finished "git rebase --abort" &&
        old=$(git rev-parse HEAD) &&
        test_tick &&
        set_fake_editor &&
        FAKE_LINES="edit 1" git rebase -i HEAD^ &&
        echo "edited again" > file7 &&
        git add file7 &&
-       test_must_fail env FAKE_COMMIT_MESSAGE=" " git rebase --continue &&
-       test $old = $(git rev-parse HEAD) &&
-       git rebase --abort
+       echo all the things >>conflict &&
+       test_must_fail git rebase --continue &&
+       test $old = $(git rev-parse HEAD)
 '
 
 test_expect_success 'auto-amend only edited commits after "edit"' '
@@ -981,7 +989,35 @@ test_expect_success 'rebase -i --root reword root commit' '
        test -z "$(git show -s --format=%p HEAD^)"
 '
 
+test_expect_success 'rebase -i --root when root has untracked file confilct' '
+       test_when_finished "reset_rebase" &&
+       git checkout -b failing-root-pick A &&
+       echo x >file2 &&
+       git rm file1 &&
+       git commit -m "remove file 1 add file 2" &&
+       echo z >file1 &&
+       set_fake_editor &&
+       test_must_fail env FAKE_LINES="1 2" git rebase -i --root &&
+       rm file1 &&
+       git rebase --continue &&
+       test "$(git log -1 --format=%B)" = "remove file 1 add file 2" &&
+       test "$(git rev-list --count HEAD)" = 2
+'
+
+test_expect_success 'rebase -i --root reword root when root has untracked file conflict' '
+       test_when_finished "reset_rebase" &&
+       echo z>file1 &&
+       set_fake_editor &&
+       test_must_fail env FAKE_LINES="reword 1 2" \
+               FAKE_COMMIT_MESSAGE="Modified A" git rebase -i --root &&
+       rm file1 &&
+       FAKE_COMMIT_MESSAGE="Reworded A" git rebase --continue &&
+       test "$(git log -1 --format=%B HEAD^)" = "Reworded A" &&
+       test "$(git rev-list --count HEAD)" = 2
+'
+
 test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
+       git checkout reword-root-branch &&
        git reset --hard &&
        git checkout conflict-branch &&
        set_fake_editor &&