]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3400-rebase.sh
rebase: set REF_HEAD_DETACH in checkout_up_to_date()
[thirdparty/git.git] / t / t3400-rebase.sh
index 0643d015255f483e43563564b46f261bcd7ed374..d5a8ee39fc478d3d3ab2ab71ec780efd76140d20 100755 (executable)
@@ -394,6 +394,15 @@ test_expect_success 'switch to branch not checked out' '
        git rebase main other
 '
 
+test_expect_success 'switch to non-branch detaches HEAD' '
+       git checkout main &&
+       old_main=$(git rev-parse HEAD) &&
+       git rebase First Second^0 &&
+       test_cmp_rev HEAD Second &&
+       test_cmp_rev main $old_main &&
+       test_must_fail git symbolic-ref HEAD
+'
+
 test_expect_success 'refuse to switch to branch checked out elsewhere' '
        git checkout main &&
        git worktree add wt &&