]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2027-checkout-track.sh
branch: accept multiple upstream branches for tracking
[thirdparty/git.git] / t / t2027-checkout-track.sh
CommitLineData
16ab794b
RS
1#!/bin/sh
2
3test_description='tests for git branch --track'
4
883b98ef 5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
16ab794b
RS
8. ./test-lib.sh
9
10test_expect_success 'setup' '
11 test_commit one &&
12 test_commit two
13'
14
15test_expect_success 'checkout --track -b creates a new tracking branch' '
883b98ef 16 git checkout --track -b branch1 main &&
16ab794b
RS
17 test $(git rev-parse --abbrev-ref HEAD) = branch1 &&
18 test $(git config --get branch.branch1.remote) = . &&
883b98ef 19 test $(git config --get branch.branch1.merge) = refs/heads/main
16ab794b
RS
20'
21
bb2198fb 22test_expect_success 'checkout --track -b rejects an extra path argument' '
883b98ef 23 test_must_fail git checkout --track -b branch2 main one.t 2>err &&
16ab794b
RS
24 test_i18ngrep "cannot be used with updating paths" err
25'
26
27test_done