builtin/rebase.c: make sure the active branch isn't moved when autostashing
[gitweb.git] / t / t3420-rebase-autostash.sh
index b8f4d034672378065a5fe08df6b8210fa3c71721..1131e0016a76cb9627b12ec0eb7ee86cb05820f8 100755 (executable)
@@ -306,4 +306,12 @@ test_expect_success 'branch is left alone when possible' '
        test unchanged-branch = "$(git rev-parse --abbrev-ref HEAD)"
 '
 
+test_expect_success 'never change active branch' '
+       git checkout -b not-the-feature-branch unrelated-onto-branch &&
+       test_when_finished "git reset --hard && git checkout master" &&
+       echo changed >file0 &&
+       git rebase --autostash not-the-feature-branch feature-branch &&
+       test_cmp_rev not-the-feature-branch unrelated-onto-branch
+'
+
 test_done