diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-29 12:22:03 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-29 12:22:03 -0700 |
commit | f81853674929cc1dfef6c3f97e4ece9072ba0b0a (patch) | |
tree | 58f59302b3d564a8c876703e7463041d4f0991e5 /t | |
parent | Merge branch 'jt/reset-grafts-when-resetting-shallow' (diff) | |
parent | rebase: set REF_HEAD_DETACH in checkout_up_to_date() (diff) | |
download | tgif-f81853674929cc1dfef6c3f97e4ece9072ba0b0a.tar.xz |
Merge branch 'jc/rebase-detach-fix'
"git rebase $base $non_branch_commit", when $base is an ancestor or
the $non_branch_commit, modified the current branch, which has been
corrected.
* jc/rebase-detach-fix:
rebase: set REF_HEAD_DETACH in checkout_up_to_date()
rebase: use test_commit helper in setup
Diffstat (limited to 't')
-rwxr-xr-x | t/t3400-rebase.sh | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 71b1735e1d..d5a8ee39fc 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -18,10 +18,7 @@ GIT_AUTHOR_EMAIL=bogus@email@address export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL test_expect_success 'prepare repository with topic branches' ' - git config core.logAllRefUpdates true && - echo First >A && - git update-index --add A && - git commit -m "Add A." && + test_commit "Add A." A First First && git checkout -b force-3way && echo Dummy >Y && git update-index --add Y && @@ -32,9 +29,7 @@ test_expect_success 'prepare repository with topic branches' ' git mv A D/A && git commit -m "Move A." && git checkout -b my-topic-branch main && - echo Second >B && - git update-index --add B && - git commit -m "Add B." && + test_commit "Add B." B Second Second && git checkout -f main && echo Third >>A && git update-index A && @@ -399,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 && |