1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 22:26:26 +02:00
git/t/t2027-checkout-track.sh
Johannes Schindelin 883b98efad t2*: adjust the references to the default branch name "main"
Carefully excluding t2106, which sees independent development elsewhere
at the time of writing, we transition above-mentioned tests to the
default branch name `main`. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t2*.sh &&
	   git checkout HEAD -- t2106\*)

This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`
for those tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-11-19 15:44:18 -08:00

28 lines
738 B
Bash
Executable File

#!/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