Skip to content

Commit

Permalink
Merge branch 'js/default-branch-name-tests-final-stretch' into jch
Browse files Browse the repository at this point in the history
Prepare tests not to be affected by the name of the default branch
"git init" creates.

* js/default-branch-name-tests-final-stretch: (28 commits)
  tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer needed
  t99*: adjust the references to the default branch name "main"
  tests(git-p4): transition to the default branch name `main`
  t9[5-7]*: adjust the references to the default branch name "main"
  t9[0-4]*: adjust the references to the default branch name "main"
  t8*: adjust the references to the default branch name "main"
  t7[5-9]*: adjust the references to the default branch name "main"
  t7[0-4]*: adjust the references to the default branch name "main"
  t6[4-9]*: adjust the references to the default branch name "main"
  t64*: preemptively adjust alignment to prepare for `master` -> `main`
  t6[0-3]*: adjust the references to the default branch name "main"
  t5[6-9]*: adjust the references to the default branch name "main"
  t55[4-9]*: adjust the references to the default branch name "main"
  t55[23]*: adjust the references to the default branch name "main"
  t551*: adjust the references to the default branch name "main"
  t550*: adjust the references to the default branch name "main"
  t5503: prepare aligned comment for replacing `master` with `main`
  t5[0-4]*: adjust the references to the default branch name "main"
  t5323: prepare centered comment for `master` -> `main`
  t4*: adjust the references to the default branch name "main"
  ...
  • Loading branch information
gitster committed Jan 13, 2021
2 parents 5924a11 + 8b70966 commit c2340ae
Show file tree
Hide file tree
Showing 355 changed files with 4,403 additions and 3,436 deletions.
2 changes: 2 additions & 0 deletions ci/run-build-and-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ esac
make
case "$jobname" in
linux-gcc)
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
make test
export GIT_TEST_SPLIT_INDEX=yes
export GIT_TEST_FULL_IN_PACK_ARRAY=true
Expand All @@ -22,6 +23,7 @@ linux-gcc)
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
export GIT_TEST_MULTI_PACK_INDEX=1
export GIT_TEST_ADD_I_USE_BUILTIN=1
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
make test
;;
linux-clang)
Expand Down
8 changes: 4 additions & 4 deletions t/annotate-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test_expect_success 'blame 2 authors' '
'

test_expect_success 'setup B1 lines (branch1)' '
git checkout -b branch1 master &&
git checkout -b branch1 main &&
echo "3A slow green fox jumps into the" >>file &&
echo "well." >>file &&
GIT_AUTHOR_NAME="B1" GIT_AUTHOR_EMAIL="B1@test.git" \
Expand All @@ -107,7 +107,7 @@ test_expect_success 'blame 2 authors + 1 branch1 author' '
'

test_expect_success 'setup B2 lines (branch2)' '
git checkout -b branch2 master &&
git checkout -b branch2 main &&
sed -e "s/2A quick brown/4A quick brown lazy dog/" <file >file.new &&
mv file.new file &&
GIT_AUTHOR_NAME="B2" GIT_AUTHOR_EMAIL="B2@test.git" \
Expand All @@ -131,11 +131,11 @@ test_expect_success 'blame --first-parent blames merge for branch1' '
'

test_expect_success 'blame ancestor' '
check_count -h master A 2 B 2
check_count -h main A 2 B 2
'

test_expect_success 'blame great-ancestor' '
check_count -h master^ A 2
check_count -h main^ A 2
'

test_expect_success 'setup evil merge' '
Expand Down
2 changes: 1 addition & 1 deletion t/lib-cvs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ setup_cvs_test_repository () {
test_cvs_co () {
# Usage: test_cvs_co BRANCH_NAME
rm -rf module-cvs-"$1"
if [ "$1" = "master" ]
if [ "$1" = "main" ]
then
$CVS co -P -d module-cvs-"$1" -A module
else
Expand Down
9 changes: 6 additions & 3 deletions t/t0002-gitfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ test_description='.git file
Verify that plumbing commands work when .git is a file
'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

objpath() {
Expand Down Expand Up @@ -96,7 +99,7 @@ test_expect_success 'enter_repo non-strict mode' '
git ls-remote enter_repo >actual &&
cat >expected <<-EOF &&
$head HEAD
$head refs/heads/master
$head refs/heads/main
$head refs/tags/foo
EOF
test_cmp expected actual
Expand All @@ -111,7 +114,7 @@ test_expect_success 'enter_repo linked checkout' '
git ls-remote foo >actual &&
cat >expected <<-EOF &&
$head HEAD
$head refs/heads/master
$head refs/heads/main
$head refs/tags/foo
EOF
test_cmp expected actual
Expand All @@ -122,7 +125,7 @@ test_expect_success 'enter_repo strict mode' '
git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&
cat >expected <<-EOF &&
$head HEAD
$head refs/heads/master
$head refs/heads/main
$head refs/tags/foo
EOF
test_cmp expected actual
Expand Down
11 changes: 7 additions & 4 deletions t/t0020-crlf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

test_description='CRLF conversion'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

has_cr() {
Expand Down Expand Up @@ -318,8 +321,8 @@ test_expect_success 'checkout with existing .gitattributes' '
git add .gitattributes .file &&
git commit -m second &&
git checkout master~1 &&
git checkout master &&
git checkout main~1 &&
git checkout main &&
test "$(git diff-files --raw)" = ""
'
Expand All @@ -331,8 +334,8 @@ test_expect_success 'checkout when deleting .gitattributes' '
git add .file2 &&
git commit -m third &&
git checkout master~1 &&
git checkout master &&
git checkout main~1 &&
git checkout main &&
has_cr .file2
'
Expand Down
43 changes: 23 additions & 20 deletions t/t0021-conversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

test_description='blob conversion via gitattributes'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

TEST_ROOT="$PWD"
Expand Down Expand Up @@ -378,8 +381,8 @@ test_expect_success PERL 'required process filter should filter data' '
test_cmp_count expected.log debug.log &&
git commit -m "test commit 2" &&
MASTER=$(git rev-parse --verify master) &&
META="ref=refs/heads/master treeish=$MASTER" &&
MAIN=$(git rev-parse --verify main) &&
META="ref=refs/heads/main treeish=$MAIN" &&
rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x=.r" &&
filter_git checkout --quiet --no-progress . &&
Expand All @@ -404,7 +407,7 @@ test_expect_success PERL 'required process filter should filter data' '
EOF
test_cmp_exclude_clean expected.log debug.log &&
filter_git checkout --quiet --no-progress master &&
filter_git checkout --quiet --no-progress main &&
cat >expected.log <<-EOF &&
START
init handshake complete
Expand Down Expand Up @@ -436,15 +439,15 @@ test_expect_success PERL 'required process filter should filter data for various
M3=$(git hash-object "testsubdir/test3 '\''sq'\'',\$x=.r") &&
EMPTY=$(git hash-object /dev/null) &&
MASTER=$(git rev-parse --verify master) &&
MAIN=$(git rev-parse --verify main) &&
cp "$TEST_ROOT/test.o" test5.r &&
git add test5.r &&
git commit -m "test commit 3" &&
git checkout empty-branch &&
filter_git rebase --onto empty-branch master^^ master &&
MASTER2=$(git rev-parse --verify master) &&
META="ref=refs/heads/master treeish=$MASTER2" &&
filter_git rebase --onto empty-branch main^^ main &&
MAIN2=$(git rev-parse --verify main) &&
META="ref=refs/heads/main treeish=$MAIN2" &&
cat >expected.log <<-EOF &&
START
init handshake complete
Expand All @@ -458,8 +461,8 @@ test_expect_success PERL 'required process filter should filter data for various
test_cmp_exclude_clean expected.log debug.log &&
git reset --hard empty-branch &&
filter_git reset --hard $MASTER &&
META="treeish=$MASTER" &&
filter_git reset --hard $MAIN &&
META="treeish=$MAIN" &&
cat >expected.log <<-EOF &&
START
init handshake complete
Expand All @@ -471,10 +474,10 @@ test_expect_success PERL 'required process filter should filter data for various
EOF
test_cmp_exclude_clean expected.log debug.log &&
git branch old-master $MASTER &&
git branch old-main $MAIN &&
git reset --hard empty-branch &&
filter_git reset --hard old-master &&
META="ref=refs/heads/old-master treeish=$MASTER" &&
filter_git reset --hard old-main &&
META="ref=refs/heads/old-main treeish=$MAIN" &&
cat >expected.log <<-EOF &&
START
init handshake complete
Expand All @@ -487,9 +490,9 @@ test_expect_success PERL 'required process filter should filter data for various
test_cmp_exclude_clean expected.log debug.log &&
git checkout -b merge empty-branch &&
git branch -f master $MASTER2 &&
filter_git merge master &&
META="treeish=$MASTER2" &&
git branch -f main $MAIN2 &&
filter_git merge main &&
META="treeish=$MAIN2" &&
cat >expected.log <<-EOF &&
START
init handshake complete
Expand All @@ -502,8 +505,8 @@ test_expect_success PERL 'required process filter should filter data for various
EOF
test_cmp_exclude_clean expected.log debug.log &&
filter_git archive master >/dev/null &&
META="ref=refs/heads/master treeish=$MASTER2" &&
filter_git archive main >/dev/null &&
META="ref=refs/heads/main treeish=$MAIN2" &&
cat >expected.log <<-EOF &&
START
init handshake complete
Expand All @@ -516,7 +519,7 @@ test_expect_success PERL 'required process filter should filter data for various
EOF
test_cmp_exclude_clean expected.log debug.log &&
TREE="$(git rev-parse $MASTER2^{tree})" &&
TREE="$(git rev-parse $MAIN2^{tree})" &&
filter_git archive $TREE >/dev/null &&
META="treeish=$TREE" &&
cat >expected.log <<-EOF &&
Expand Down Expand Up @@ -856,8 +859,8 @@ test_expect_success PERL 'delayed checkout in process filter' '
) &&
S=$(test_file_size "$TEST_ROOT/test.o") &&
PM="ref=refs/heads/master treeish=$(git -C repo rev-parse --verify master) " &&
M="${PM}blob=$(git -C repo rev-parse --verify master:test.a)" &&
PM="ref=refs/heads/main treeish=$(git -C repo rev-parse --verify main) " &&
M="${PM}blob=$(git -C repo rev-parse --verify main:test.a)" &&
cat >a.exp <<-EOF &&
START
init handshake complete
Expand Down
4 changes: 2 additions & 2 deletions t/t0027-auto-crlf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ test_expect_success 'ls-files --eol -o Text/Binary' '
test_cmp expect actual
'

test_expect_success 'setup master' '
test_expect_success 'setup main' '
echo >.gitattributes &&
git checkout -b master &&
git checkout -b main &&
git add .gitattributes &&
git commit -m "add .gitattributes" . &&
printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\nLINETWO\nLINETHREE" >LF &&
Expand Down
7 changes: 5 additions & 2 deletions t/t0028-working-tree-encoding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

test_description='working-tree-encoding conversion via gitattributes'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

GIT_TRACE_WORKING_TREE_ENCODING=1 && export GIT_TRACE_WORKING_TREE_ENCODING
Expand Down Expand Up @@ -215,7 +218,7 @@ test_expect_success 'error if encoding round trip is not the same during refresh
TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16le) &&
git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16le &&
COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) &&
git update-ref refs/heads/master $COMMIT &&
git update-ref refs/heads/main $COMMIT &&
test_must_fail git checkout HEAD^ 2>err.out &&
test_i18ngrep "error: .* overwritten by checkout:" err.out
Expand All @@ -231,7 +234,7 @@ test_expect_success 'error if encoding garbage is already in Git' '
TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16) &&
git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16 &&
COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) &&
git update-ref refs/heads/master $COMMIT &&
git update-ref refs/heads/main $COMMIT &&
git diff 2>err.out &&
test_i18ngrep "error: BOM is required" err.out
Expand Down
13 changes: 8 additions & 5 deletions t/t0041-usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

test_description='Test commands behavior when given invalid argument value'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

test_expect_success 'setup ' '
Expand Down Expand Up @@ -41,8 +44,8 @@ test_expect_success 'tag usage error' '
'

test_expect_success 'branch --contains <existent_commit>' '
git branch --contains "master" >actual 2>actual.err &&
test_i18ngrep "master" actual &&
git branch --contains "main" >actual 2>actual.err &&
test_i18ngrep "main" actual &&
test_line_count = 0 actual.err
'

Expand All @@ -54,7 +57,7 @@ test_expect_success 'branch --contains <inexistent_commit>' '
'

test_expect_success 'branch --no-contains <existent_commit>' '
git branch --no-contains "master" >actual 2>actual.err &&
git branch --no-contains "main" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_line_count = 0 actual.err
'
Expand All @@ -73,7 +76,7 @@ test_expect_success 'branch usage error' '
'

test_expect_success 'for-each-ref --contains <existent_object>' '
git for-each-ref --contains "master" >actual 2>actual.err &&
git for-each-ref --contains "main" >actual 2>actual.err &&
test_line_count = 2 actual &&
test_line_count = 0 actual.err
'
Expand All @@ -86,7 +89,7 @@ test_expect_success 'for-each-ref --contains <inexistent_object>' '
'

test_expect_success 'for-each-ref --no-contains <existent_object>' '
git for-each-ref --no-contains "master" >actual 2>actual.err &&
git for-each-ref --no-contains "main" >actual 2>actual.err &&
test_line_count = 0 actual &&
test_line_count = 0 actual.err
'
Expand Down
9 changes: 6 additions & 3 deletions t/t0050-filesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

test_description='Various filesystem issues'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

auml=$(printf '\303\244')
Expand Down Expand Up @@ -65,7 +68,7 @@ test_expect_success "setup case tests" '
git mv camelcase tmp &&
git mv tmp CamelCase &&
git commit -m "rename" &&
git checkout -f master
git checkout -f main
'

test_expect_success 'rename (case change)' '
Expand Down Expand Up @@ -118,7 +121,7 @@ test_expect_success "setup unicode normalization tests" '
git mv $aumlcdiar tmp &&
git mv tmp "$auml" &&
git commit -m rename &&
git checkout -f master
git checkout -f main
'

$test_unicode 'rename (silent unicode normalization)' '
Expand Down Expand Up @@ -147,7 +150,7 @@ test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case in
git add gitweb &&
git commit -m "add gitweb/subdir/file" &&
git checkout master
git checkout main
)
'

Expand Down
4 changes: 2 additions & 2 deletions t/t0060-path-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ test_git_path GIT_COMMON_DIR=bar info/sparse-checkout .git/info/sparse-check
test_git_path GIT_COMMON_DIR=bar info//sparse-checkout .git/info//sparse-checkout
test_git_path GIT_COMMON_DIR=bar remotes/bar bar/remotes/bar
test_git_path GIT_COMMON_DIR=bar branches/bar bar/branches/bar
test_git_path GIT_COMMON_DIR=bar logs/refs/heads/master bar/logs/refs/heads/master
test_git_path GIT_COMMON_DIR=bar refs/heads/master bar/refs/heads/master
test_git_path GIT_COMMON_DIR=bar logs/refs/heads/main bar/logs/refs/heads/main
test_git_path GIT_COMMON_DIR=bar refs/heads/main bar/refs/heads/main
test_git_path GIT_COMMON_DIR=bar refs/bisect/foo .git/refs/bisect/foo
test_git_path GIT_COMMON_DIR=bar hooks/me bar/hooks/me
test_git_path GIT_COMMON_DIR=bar config bar/config
Expand Down

0 comments on commit c2340ae

Please sign in to comment.