Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-05 21:43:03 +0300
committerJunio C Hamano <gitster@pobox.com>2020-03-05 21:43:03 +0300
commita0ab37de61c9ac7f57105d6b170947abaf1b642c (patch)
tree25d416ba467d741ee231dab53392393b795875f4 /t/t3400-rebase.sh
parent4a2e91db652e197803c6f29e2c2f1c9dfbc16506 (diff)
parentb5cabb4a967fa455378ee7ddfa831a9bf0244753 (diff)
Merge branch 'es/do-not-let-rebase-switch-to-protected-branch'
"git rebase BASE BRANCH" rebased/updated the tip of BRANCH and checked it out, even when the BRANCH is checked out in a different worktree. This has been corrected. * es/do-not-let-rebase-switch-to-protected-branch: rebase: refuse to switch to branch already checked out elsewhere t3400: make test clean up after itself
Diffstat (limited to 't/t3400-rebase.sh')
-rwxr-xr-xt/t3400-rebase.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 7c7e085043..40d2975995 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -143,11 +143,11 @@ test_expect_success 'setup: recover' '
test_expect_success 'Show verbose error when HEAD could not be detached' '
>B &&
+ test_when_finished "rm -f B" &&
test_must_fail git rebase topic 2>output.err >output.out &&
test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" output.err &&
test_i18ngrep B output.err
'
-rm -f B
test_expect_success 'fail when upstream arg is missing and not on branch' '
git checkout topic &&
@@ -401,4 +401,22 @@ test_expect_success 'rebase -c rebase.useBuiltin=false warning' '
test_must_be_empty err
'
+test_expect_success 'switch to branch checked out here' '
+ git checkout master &&
+ git rebase master master
+'
+
+test_expect_success 'switch to branch not checked out' '
+ git checkout master &&
+ git branch other &&
+ git rebase master other
+'
+
+test_expect_success 'refuse to switch to branch checked out elsewhere' '
+ git checkout master &&
+ git worktree add wt &&
+ test_must_fail git -C wt rebase master master 2>err &&
+ test_i18ngrep "already checked out" err
+'
+
test_done