Revision 1369935987014925e5e8c23b4a334401e549c585 authored by Tran Ngoc Quan on 08 March 2021, 02:00:45 UTC, committed by Tran Ngoc Quan on 08 March 2021, 02:03:04 UTC
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
1 parent 2f176de
Raw File
t2027-checkout-track.sh
#!/bin/sh

test_description='tests for git branch --track'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

test_expect_success 'setup' '
	test_commit one &&
	test_commit two
'

test_expect_success 'checkout --track -b creates a new tracking branch' '
	git checkout --track -b branch1 main &&
	test $(git rev-parse --abbrev-ref HEAD) = branch1 &&
	test $(git config --get branch.branch1.remote) = . &&
	test $(git config --get branch.branch1.merge) = refs/heads/main
'

test_expect_success 'checkout --track -b rejects an extra path argument' '
	test_must_fail git checkout --track -b branch2 main one.t 2>err &&
	test_i18ngrep "cannot be used with updating paths" err
'

test_done
back to top