diff options
Diffstat (limited to 't/t2018-checkout-branch.sh')
-rwxr-xr-x | t/t2018-checkout-branch.sh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index 93be1c0..43551cc 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -2,6 +2,8 @@ test_description='checkout' +TEST_CREATE_REPO_NO_TEMPLATE=1 +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh # Arguments: [!] <branch> <oid> [<checkout options>] @@ -85,6 +87,19 @@ test_expect_success 'setup' ' git branch -m branch1 ' +test_expect_success 'checkout a branch without refs/heads/* prefix' ' + git clone --no-tags . repo-odd-prefix && + ( + cd repo-odd-prefix && + + origin=$(git symbolic-ref refs/remotes/origin/HEAD) && + git symbolic-ref refs/heads/a-branch "$origin" && + + git checkout -f a-branch && + git checkout -f a-branch + ) +' + test_expect_success 'checkout -b to a new branch, set to HEAD' ' test_when_finished " git checkout branch1 && @@ -148,7 +163,7 @@ test_expect_success 'checkout -b to an existing branch fails' ' test_expect_success 'checkout -b to @{-1} fails with the right branch name' ' git checkout branch1 && git checkout branch2 && - echo >expect "fatal: A branch named '\''branch1'\'' already exists." && + echo >expect "fatal: a branch named '\''branch1'\'' already exists" && test_must_fail git checkout -b @{-1} 2>actual && test_cmp expect actual ' @@ -244,11 +259,12 @@ test_expect_success 'checkout -b to a new branch preserves mergeable changes des git checkout branch1-scratch && test_might_fail git branch -D branch3 && git config core.sparseCheckout false && - rm .git/info/sparse-checkout" && + rm -rf .git/info" && test_commit file2 && echo stuff >>file1 && + mkdir .git/info && echo file2 >.git/info/sparse-checkout && git config core.sparseCheckout true && @@ -262,12 +278,12 @@ test_expect_success 'checkout -b to a new branch preserves mergeable changes des test_expect_success 'checkout -b rejects an invalid start point' ' test_must_fail git checkout -b branch4 file1 2>err && - test_i18ngrep "is not a commit" err + test_grep "is not a commit" err ' test_expect_success 'checkout -b rejects an extra path argument' ' test_must_fail git checkout -b branch5 branch1 file1 2>err && - test_i18ngrep "Cannot update paths and switch to branch" err + test_grep "Cannot update paths and switch to branch" err ' test_done |