summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/t1400-update-ref.sh75
-rwxr-xr-xt/t2016-checkout-patch.sh5
-rwxr-xr-xt/t3200-branch.sh265
-rwxr-xr-xt/t3201-branch-contains.sh83
-rwxr-xr-xt/t3203-branch-output.sh43
-rwxr-xr-xt/t3205-branch-color.sh9
-rwxr-xr-xt/t4205-log-pretty-formats.sh99
-rwxr-xr-xt/t5310-pack-bitmaps.sh177
-rwxr-xr-xt/t5323-pack-redundant.sh37
-rwxr-xr-xt/t5505-remote.sh156
-rwxr-xr-xt/t5510-fetch.sh168
-rwxr-xr-xt/t5526-fetch-submodules.sh117
-rwxr-xr-xt/t5582-fetch-negative-refspec.sh51
-rwxr-xr-xt/t5703-upload-pack-ref-in-want.sh65
-rwxr-xr-xt/t6302-for-each-ref-filter.sh59
-rwxr-xr-xt/t7601-merge-pull-config.sh66
-rwxr-xr-xt/t7900-maintenance.sh16
-rwxr-xr-xt/t9902-completion.sh309
-rw-r--r--t/test-lib.sh8
19 files changed, 1140 insertions, 668 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 31b64be521..6ee7d216fb 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -8,7 +8,7 @@ test_description='Test git update-ref and basic ref logging'
Z=$ZERO_OID
-m=refs/heads/master
+m=refs/heads/main
n_dir=refs/heads/gu
n=$n_dir/fixes
outside=refs/foo
@@ -27,10 +27,11 @@ create_test_commits ()
}
test_expect_success setup '
+ git checkout --orphan main &&
create_test_commits "" &&
mkdir $bare &&
cd $bare &&
- git init --bare &&
+ git init --bare -b main &&
create_test_commits "bare" &&
cd -
'
@@ -264,7 +265,7 @@ test_expect_success "(not) changed .git/$m" '
! test $B = $(git show-ref -s --verify $m)
'
-rm -f .git/logs/refs/heads/master
+rm -f .git/logs/refs/heads/main
test_expect_success "create $m (logged by touch)" '
test_config core.logAllRefUpdates false &&
GIT_COMMITTER_DATE="2005-05-26 23:30" \
@@ -300,7 +301,7 @@ test_expect_success 'symref empty directory removal' '
git branch e1/e2/r1 HEAD &&
git branch e1/r2 HEAD &&
git checkout e1/e2/r1 &&
- test_when_finished "git checkout master" &&
+ test_when_finished "git checkout main" &&
test_path_is_file .git/refs/heads/e1/e2/r1 &&
test_path_is_file .git/logs/refs/heads/e1/e2/r1 &&
git update-ref -d HEAD &&
@@ -364,68 +365,68 @@ test_expect_success 'set up for querying the reflog' '
ed="Thu, 26 May 2005 18:32:00 -0500"
gd="Thu, 26 May 2005 18:33:00 -0500"
ld="Thu, 26 May 2005 18:43:00 -0500"
-test_expect_success 'Query "master@{May 25 2005}" (before history)' '
+test_expect_success 'Query "main@{May 25 2005}" (before history)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
+ git rev-parse --verify "main@{May 25 2005}" >o 2>e &&
echo "$C" >expect &&
test_cmp expect o &&
- echo "warning: log for '\''master'\'' only goes back to $ed" >expect &&
+ echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
test_i18ncmp expect e
'
-test_expect_success 'Query master@{2005-05-25} (before history)' '
+test_expect_success 'Query main@{2005-05-25} (before history)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify master@{2005-05-25} >o 2>e &&
+ git rev-parse --verify main@{2005-05-25} >o 2>e &&
echo "$C" >expect &&
test_cmp expect o &&
- echo "warning: log for '\''master'\'' only goes back to $ed" >expect &&
+ echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
test_i18ncmp expect e
'
-test_expect_success 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' '
+test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before history)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
+ git rev-parse --verify "main@{May 26 2005 23:31:59}" >o 2>e &&
echo "$C" >expect &&
test_cmp expect o &&
- echo "warning: log for '\''master'\'' only goes back to $ed" >expect &&
+ echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
test_i18ncmp expect e
'
-test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' '
+test_expect_success 'Query "main@{May 26 2005 23:32:00}" (exactly history start)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
+ git rev-parse --verify "main@{May 26 2005 23:32:00}" >o 2>e &&
echo "$C" >expect &&
test_cmp expect o &&
test_must_be_empty e
'
-test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
+test_expect_success 'Query "main@{May 26 2005 23:32:30}" (first non-creation change)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
+ git rev-parse --verify "main@{May 26 2005 23:32:30}" >o 2>e &&
echo "$A" >expect &&
test_cmp expect o &&
test_must_be_empty e
'
-test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
+test_expect_success 'Query "main@{2005-05-26 23:33:01}" (middle of history with gap)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
+ git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
echo "$B" >expect &&
test_cmp expect o &&
test_i18ngrep -F "warning: log for ref $m has gap after $gd" e
'
-test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
+test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
+ git rev-parse --verify "main@{2005-05-26 23:38:00}" >o 2>e &&
echo "$Z" >expect &&
test_cmp expect o &&
test_must_be_empty e
'
-test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
+test_expect_success 'Query "main@{2005-05-26 23:43:00}" (exact end of history)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
+ git rev-parse --verify "main@{2005-05-26 23:43:00}" >o 2>e &&
echo "$E" >expect &&
test_cmp expect o &&
test_must_be_empty e
'
-test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
+test_expect_success 'Query "main@{2005-05-28}" (past end of history)' '
test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
+ git rev-parse --verify "main@{2005-05-28}" >o 2>e &&
echo "$D" >expect &&
test_cmp expect o &&
test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e
@@ -467,14 +468,14 @@ test_expect_success 'git commit logged updates' '
'
unset h_TEST h_OTHER h_FIXED h_MERGED
-test_expect_success 'git cat-file blob master:F (expect OTHER)' '
- test OTHER = $(git cat-file blob master:F)
+test_expect_success 'git cat-file blob main:F (expect OTHER)' '
+ test OTHER = $(git cat-file blob main:F)
'
-test_expect_success 'git cat-file blob master@{2005-05-26 23:30}:F (expect TEST)' '
- test TEST = $(git cat-file blob "master@{2005-05-26 23:30}:F")
+test_expect_success 'git cat-file blob main@{2005-05-26 23:30}:F (expect TEST)' '
+ test TEST = $(git cat-file blob "main@{2005-05-26 23:30}:F")
'
-test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER)' '
- test OTHER = $(git cat-file blob "master@{2005-05-26 23:42}:F")
+test_expect_success 'git cat-file blob main@{2005-05-26 23:42}:F (expect OTHER)' '
+ test OTHER = $(git cat-file blob "main@{2005-05-26 23:42}:F")
'
# Test adding and deleting pseudorefs
@@ -586,21 +587,21 @@ test_expect_success 'stdin fails on unknown command' '
'
test_expect_success 'stdin fails on unbalanced quotes' '
- echo "create $a \"master" >stdin &&
+ echo "create $a \"main" >stdin &&
test_must_fail git update-ref --stdin <stdin 2>err &&
- grep "fatal: badly quoted argument: \\\"master" err
+ grep "fatal: badly quoted argument: \\\"main" err
'
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'stdin fails on invalid escape' '
+test_expect_success 'stdin fails on invalid escape' '
echo "create $a \"ma\zn\"" >stdin &&
test_must_fail git update-ref --stdin <stdin 2>err &&
grep "fatal: badly quoted argument: \\\"ma\\\\zn\\\"" err
'
test_expect_success 'stdin fails on junk after quoted argument' '
- echo "create \"$a\"master" >stdin &&
+ echo "create \"$a\"main" >stdin &&
test_must_fail git update-ref --stdin <stdin 2>err &&
- grep "fatal: unexpected character after quoted argument: \\\"$a\\\"master" err
+ grep "fatal: unexpected character after quoted argument: \\\"$a\\\"main" err
'
test_expect_success 'stdin fails create with no ref' '
@@ -710,7 +711,7 @@ test_expect_success 'stdin succeeds with quoted argument' '
test_cmp expect actual
'
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'stdin succeeds with escaped character' '
+test_expect_success 'stdin succeeds with escaped character' '
git update-ref -d $a &&
echo "create $a \"ma\\151n\"" >stdin &&
git update-ref --stdin <stdin &&
diff --git a/t/t2016-checkout-patch.sh b/t/t2016-checkout-patch.sh
index d91a329eb3..abfd586c32 100755
--- a/t/t2016-checkout-patch.sh
+++ b/t/t2016-checkout-patch.sh
@@ -123,4 +123,9 @@ test_expect_success PERL 'none of this moved HEAD' '
verify_saved_head
'
+test_expect_success PERL 'empty tree can be handled' '
+ test_when_finished "git reset --hard" &&
+ git checkout -p $(test_oid empty_tree) --
+'
+
test_done
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index a0b832d59e..3ec3e1d730 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -12,6 +12,7 @@ test_expect_success 'prepare a trivial repository' '
echo Hello >A &&
git update-index --add A &&
git commit -m "Initial commit." &&
+ git branch -M main &&
echo World >>A &&
git update-index --add A &&
git commit -m "Second commit." &&
@@ -27,8 +28,8 @@ test_expect_success 'branch -h in broken repository' '
mkdir broken &&
(
cd broken &&
- git init &&
- >.git/refs/heads/master &&
+ git init -b main &&
+ >.git/refs/heads/main &&
test_expect_code 129 git branch -h >usage 2>&1
) &&
test_i18ngrep "[Uu]sage" broken/usage
@@ -42,8 +43,8 @@ test_expect_success 'git branch a/b/c should create a branch' '
git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c
'
-test_expect_success 'git branch mb master... should create a branch' '
- git branch mb master... && test_path_is_file .git/refs/heads/mb
+test_expect_success 'git branch mb main... should create a branch' '
+ git branch mb main... && test_path_is_file .git/refs/heads/mb
'
test_expect_success 'git branch HEAD should fail' '
@@ -51,7 +52,7 @@ test_expect_success 'git branch HEAD should fail' '
'
cat >expect <<EOF
-$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
+$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from main
EOF
test_expect_success 'git branch --create-reflog d/e/f should create a branch and a log' '
GIT_COMMITTER_DATE="2005-05-26 23:30" \
@@ -110,7 +111,7 @@ test_expect_success 'git branch -m n/n n should work' '
test_expect_success 'git branch -m bbb should rename checked out branch' '
test_when_finished git branch -D bbb &&
- test_when_finished git checkout master &&
+ test_when_finished git checkout main &&
git checkout -b aaa &&
git commit --allow-empty -m "a new commit" &&
git rev-parse aaa@{0} >expect &&
@@ -124,7 +125,7 @@ test_expect_success 'git branch -m bbb should rename checked out branch' '
test_expect_success 'renaming checked out branch works with d/f conflict' '
test_when_finished "git branch -D foo/bar || git branch -D foo" &&
- test_when_finished git checkout master &&
+ test_when_finished git checkout main &&
git checkout -b foo &&
git branch -m foo/bar &&
git symbolic-ref HEAD >actual &&
@@ -178,14 +179,14 @@ test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD'
'
test_expect_success 'git branch -M should leave orphaned HEAD alone' '
- git init orphan &&
+ git init -b main orphan &&
(
cd orphan &&
test_commit initial &&
git checkout --orphan lonely &&
grep lonely .git/HEAD &&
test_path_is_missing .git/refs/head/lonely &&
- git branch -M master mistress &&
+ git branch -M main mistress &&
grep lonely .git/HEAD
)
'
@@ -201,7 +202,7 @@ test_expect_success 'resulting reflog can be shown by log -g' '
'
test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' '
- git checkout master &&
+ git checkout main &&
git worktree add -b baz bazdir &&
git worktree add -f bazdir2 baz &&
git branch -M baz bam &&
@@ -224,18 +225,18 @@ test_expect_success 'git branch -M baz bam should succeed within a worktree in w
git worktree prune
'
-test_expect_success 'git branch -M master should work when master is checked out' '
- git checkout master &&
- git branch -M master
+test_expect_success 'git branch -M main should work when main is checked out' '
+ git checkout main &&
+ git branch -M main
'
-test_expect_success 'git branch -M master master should work when master is checked out' '
- git checkout master &&
- git branch -M master master
+test_expect_success 'git branch -M main main should work when main is checked out' '
+ git checkout main &&
+ git branch -M main main
'
-test_expect_success 'git branch -M topic topic should work when master is checked out' '
- git checkout master &&
+test_expect_success 'git branch -M topic topic should work when main is checked out' '
+ git checkout main &&
git branch topic &&
git branch -M topic topic
'
@@ -289,11 +290,11 @@ test_expect_success 'deleting checked-out branch from repo that is a submodule'
test_expect_success 'bare main worktree has HEAD at branch deleted by secondary worktree' '
test_when_finished "rm -rf nonbare base secondary" &&
- git init nonbare &&
+ git init -b main nonbare &&
test_commit -C nonbare x &&
git clone --bare nonbare bare &&
- git -C bare worktree add --detach ../secondary master &&
- git -C secondary branch -D master
+ git -C bare worktree add --detach ../secondary main &&
+ git -C secondary branch -D main
'
test_expect_success 'git branch --list -v with --abbrev' '
@@ -321,7 +322,7 @@ test_expect_success 'git branch --list -v with --abbrev' '
'
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch --column' '
+test_expect_success 'git branch --column' '
COLUMNS=81 git branch --column=column >actual &&
cat >expect <<\EOF &&
a/b/c bam foo l * main n o/p r
@@ -345,7 +346,7 @@ test_expect_success 'git branch --column with an extremely long branch name' '
j/k
l
m/m
-* master
+* main
mb
n
o/o
@@ -358,7 +359,7 @@ EOF
test_cmp expect actual
'
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch with column.*' '
+test_expect_success 'git branch with column.*' '
git config column.ui column &&
git config column.branch "dense" &&
COLUMNS=80 git branch >actual &&
@@ -375,7 +376,7 @@ test_expect_success 'git branch --column -v should fail' '
test_must_fail git branch --column -v
'
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch -v with column.ui ignored' '
+test_expect_success 'git branch -v with column.ui ignored' '
git config column.ui column &&
COLUMNS=80 git branch -v | cut -c -8 | sed "s/ *$//" >actual &&
git config --unset column.ui &&
@@ -388,7 +389,7 @@ test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch -v with column.ui ignore
j/k
l
m/m
-* master
+* main
mb
n
o/o
@@ -427,8 +428,8 @@ test_expect_success 'config information was renamed, too' '
'
test_expect_success 'git branch -m correctly renames multiple config sections' '
- test_when_finished "git checkout master" &&
- git checkout -b source master &&
+ test_when_finished "git checkout main" &&
+ git checkout -b source main &&
# Assert that a config file with multiple config sections has
# those sections preserved...
@@ -587,18 +588,18 @@ test_expect_success 'git branch -C c1 c2 should never touch HEAD' '
! grep "$msg$" .git/logs/HEAD
'
-test_expect_success 'git branch -C master should work when master is checked out' '
- git checkout master &&
- git branch -C master
+test_expect_success 'git branch -C main should work when main is checked out' '
+ git checkout main &&
+ git branch -C main
'
-test_expect_success 'git branch -C master master should work when master is checked out' '
- git checkout master &&
- git branch -C master master
+test_expect_success 'git branch -C main main should work when main is checked out' '
+ git checkout main &&
+ git branch -C main main
'
-test_expect_success 'git branch -C main5 main5 should work when master is checked out' '
- git checkout master &&
+test_expect_success 'git branch -C main5 main5 should work when main is checked out' '
+ git checkout main &&
git branch main5 &&
git branch -C main5 main5
'
@@ -620,8 +621,8 @@ test_expect_success 'git branch -C ab cd should overwrite existing config for cd
test_expect_success 'git branch -c correctly copies multiple config sections' '
FOO=1 &&
export FOO &&
- test_when_finished "git checkout master" &&
- git checkout -b source2 master &&
+ test_when_finished "git checkout main" &&
+ git checkout -b source2 main &&
# Assert that a config file with multiple config sections has
# those sections preserved...
@@ -711,10 +712,10 @@ test_expect_success 'deleting a self-referential symref' '
'
test_expect_success 'renaming a symref is not allowed' '
- git symbolic-ref refs/heads/topic refs/heads/master &&
+ git symbolic-ref refs/heads/topic refs/heads/main &&
test_must_fail git branch -m topic new-topic &&
git symbolic-ref refs/heads/topic &&
- test_path_is_file .git/refs/heads/master &&
+ test_path_is_file .git/refs/heads/main &&
test_path_is_missing .git/refs/heads/new-topic
'
@@ -728,27 +729,27 @@ test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for
test_expect_success 'test tracking setup via --track' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --track my1 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --track my1 local/main &&
test $(git config branch.my1.remote) = local &&
- test $(git config branch.my1.merge) = refs/heads/master
+ test $(git config branch.my1.merge) = refs/heads/main
'
test_expect_success 'test tracking setup (non-wildcard, matching)' '
git config remote.local.url . &&
- git config remote.local.fetch refs/heads/master:refs/remotes/local/master &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --track my4 local/master &&
+ git config remote.local.fetch refs/heads/main:refs/remotes/local/main &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --track my4 local/main &&
test $(git config branch.my4.remote) = local &&
- test $(git config branch.my4.merge) = refs/heads/master
+ test $(git config branch.my4.merge) = refs/heads/main
'
test_expect_success 'tracking setup fails on non-matching refspec' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
git config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
- test_must_fail git branch --track my5 local/master &&
+ test_must_fail git branch --track my5 local/main &&
test_must_fail git config branch.my5.remote &&
test_must_fail git config branch.my5.merge
'
@@ -757,21 +758,21 @@ test_expect_success 'test tracking setup via config' '
git config branch.autosetupmerge true &&
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch my3 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch my3 local/main &&
test $(git config branch.my3.remote) = local &&
- test $(git config branch.my3.merge) = refs/heads/master
+ test $(git config branch.my3.merge) = refs/heads/main
'
test_expect_success 'test overriding tracking setup via --no-track' '
git config branch.autosetupmerge true &&
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --no-track my2 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --no-track my2 local/main &&
git config branch.autosetupmerge false &&
! test "$(git config branch.my2.remote)" = local &&
- ! test "$(git config branch.my2.merge)" = refs/heads/master
+ ! test "$(git config branch.my2.merge)" = refs/heads/main
'
test_expect_success 'no tracking without .fetch entries' '
@@ -836,26 +837,26 @@ test_expect_success 'branch from tag w/--track causes failure' '
test_expect_success '--set-upstream-to fails on multiple branches' '
echo "fatal: too many arguments to set new upstream" >expect &&
- test_must_fail git branch --set-upstream-to master a b c 2>err &&
+ test_must_fail git branch --set-upstream-to main a b c 2>err &&
test_i18ncmp expect err
'
test_expect_success '--set-upstream-to fails on detached HEAD' '
git checkout HEAD^{} &&
test_when_finished git checkout - &&
- echo "fatal: could not set upstream of HEAD to master when it does not point to any branch." >expect &&
- test_must_fail git branch --set-upstream-to master 2>err &&
+ echo "fatal: could not set upstream of HEAD to main when it does not point to any branch." >expect &&
+ test_must_fail git branch --set-upstream-to main 2>err &&
test_i18ncmp expect err
'
test_expect_success '--set-upstream-to fails on a missing dst branch' '
echo "fatal: branch '"'"'does-not-exist'"'"' does not exist" >expect &&
- test_must_fail git branch --set-upstream-to master does-not-exist 2>err &&
+ test_must_fail git branch --set-upstream-to main does-not-exist 2>err &&
test_i18ncmp expect err
'
test_expect_success '--set-upstream-to fails on a missing src branch' '
- test_must_fail git branch --set-upstream-to does-not-exist master 2>err &&
+ test_must_fail git branch --set-upstream-to does-not-exist main 2>err &&
test_i18ngrep "the requested upstream branch '"'"'does-not-exist'"'"' does not exist" err
'
@@ -874,20 +875,20 @@ test_expect_success '--set-upstream-to fails on locked config' '
'
test_expect_success 'use --set-upstream-to modify HEAD' '
- test_config branch.master.remote foo &&
- test_config branch.master.merge foo &&
+ test_config branch.main.remote foo &&
+ test_config branch.main.merge foo &&
git branch my12 &&
git branch --set-upstream-to my12 &&
- test "$(git config branch.master.remote)" = "." &&
- test "$(git config branch.master.merge)" = "refs/heads/my12"
+ test "$(git config branch.main.remote)" = "." &&
+ test "$(git config branch.main.merge)" = "refs/heads/my12"
'
test_expect_success 'use --set-upstream-to modify a particular branch' '
git branch my13 &&
- git branch --set-upstream-to master my13 &&
+ git branch --set-upstream-to main my13 &&
test_when_finished "git branch --unset-upstream my13" &&
test "$(git config branch.my13.remote)" = "." &&
- test "$(git config branch.my13.merge)" = "refs/heads/master"
+ test "$(git config branch.my13.merge)" = "refs/heads/main"
'
test_expect_success '--unset-upstream should fail if given a non-existent branch' '
@@ -906,14 +907,14 @@ test_expect_success '--unset-upstream should fail if config is locked' '
test_expect_success 'test --unset-upstream on HEAD' '
git branch my14 &&
- test_config branch.master.remote foo &&
- test_config branch.master.merge foo &&
+ test_config branch.main.remote foo &&
+ test_config branch.main.merge foo &&
git branch --set-upstream-to my14 &&
git branch --unset-upstream &&
- test_must_fail git config branch.master.remote &&
- test_must_fail git config branch.master.merge &&
+ test_must_fail git config branch.main.remote &&
+ test_must_fail git config branch.main.merge &&
# fail for a branch without upstream set
- echo "fatal: Branch '"'"'master'"'"' has no upstream information" >expect &&
+ echo "fatal: Branch '"'"'main'"'"' has no upstream information" >expect &&
test_must_fail git branch --unset-upstream 2>err &&
test_i18ncmp expect err
'
@@ -934,14 +935,14 @@ test_expect_success '--unset-upstream should fail on detached HEAD' '
test_expect_success 'test --unset-upstream on a particular branch' '
git branch my15 &&
- git branch --set-upstream-to master my14 &&
+ git branch --set-upstream-to main my14 &&
git branch --unset-upstream my14 &&
test_must_fail git config branch.my14.remote &&
test_must_fail git config branch.my14.merge
'
test_expect_success 'disabled option --set-upstream fails' '
- test_must_fail git branch --set-upstream origin/master
+ test_must_fail git branch --set-upstream origin/main
'
test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
@@ -956,32 +957,32 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
# Keep this test last, as it changes the current branch
cat >expect <<EOF
-$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
+$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from main
EOF
test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' '
GIT_COMMITTER_DATE="2005-05-26 23:30" \
- git checkout -b g/h/i -l master &&
+ git checkout -b g/h/i -l main &&
test_path_is_file .git/refs/heads/g/h/i &&
test_path_is_file .git/logs/refs/heads/g/h/i &&
test_cmp expect .git/logs/refs/heads/g/h/i
'
test_expect_success 'checkout -b makes reflog by default' '
- git checkout master &&
+ git checkout main &&
git config --unset core.logAllRefUpdates &&
git checkout -b alpha &&
git rev-parse --verify alpha@{0}
'
test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
- git checkout master &&
+ git checkout main &&
git config core.logAllRefUpdates false &&
git checkout -b beta &&
test_must_fail git rev-parse --verify beta@{0}
'
test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
- git checkout master &&
+ git checkout main &&
git checkout -lb gamma &&
git config --unset core.logAllRefUpdates &&
git rev-parse --verify gamma@{0}
@@ -990,10 +991,10 @@ test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates
test_expect_success 'avoid ambiguous track' '
git config branch.autosetupmerge true &&
git config remote.ambi1.url lalala &&
- git config remote.ambi1.fetch refs/heads/lalala:refs/heads/master &&
+ git config remote.ambi1.fetch refs/heads/lalala:refs/heads/main &&
git config remote.ambi2.url lilili &&
- git config remote.ambi2.fetch refs/heads/lilili:refs/heads/master &&
- test_must_fail git branch all1 master &&
+ git config remote.ambi2.fetch refs/heads/lilili:refs/heads/main &&
+ test_must_fail git branch all1 main &&
test -z "$(git config branch.all1.merge)"
'
@@ -1049,10 +1050,10 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase local &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --track myr5 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --track myr5 local/main &&
test "$(git config branch.myr5.remote)" = local &&
- test "$(git config branch.myr5.merge)" = refs/heads/master &&
+ test "$(git config branch.myr5.merge)" = refs/heads/main &&
! test "$(git config branch.myr5.rebase)" = true
'
@@ -1060,10 +1061,10 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase never &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --track myr6 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --track myr6 local/main &&
test "$(git config branch.myr6.remote)" = local &&
- test "$(git config branch.myr6.merge)" = refs/heads/master &&
+ test "$(git config branch.myr6.merge)" = refs/heads/main &&
! test "$(git config branch.myr6.rebase)" = true
'
@@ -1071,10 +1072,10 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --track myr7 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --track myr7 local/main &&
test "$(git config branch.myr7.remote)" = local &&
- test "$(git config branch.myr7.merge)" = refs/heads/master &&
+ test "$(git config branch.myr7.merge)" = refs/heads/main &&
test "$(git config branch.myr7.rebase)" = true
'
@@ -1082,10 +1083,10 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --track myr8 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --track myr8 local/main &&
test "$(git config branch.myr8.remote)" = local &&
- test "$(git config branch.myr8.merge)" = refs/heads/master &&
+ test "$(git config branch.myr8.merge)" = refs/heads/main &&
test "$(git config branch.myr8.rebase)" = true
'
@@ -1093,10 +1094,10 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
git config --unset branch.autosetuprebase &&
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --track myr9 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --track myr9 local/main &&
test "$(git config branch.myr9.remote)" = local &&
- test "$(git config branch.myr9.merge)" = refs/heads/master &&
+ test "$(git config branch.myr9.merge)" = refs/heads/main &&
test "z$(git config branch.myr9.rebase)" = z
'
@@ -1114,7 +1115,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
git branch --no-track myr11 mybase2 &&
test "z$(git config branch.myr11.remote)" = z &&
test "z$(git config branch.myr11.merge)" = z &&
@@ -1124,8 +1125,8 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
- git branch --no-track myr12 local/master &&
+ (git show-ref -q refs/remotes/local/main || git fetch local) &&
+ git branch --no-track myr12 local/main &&
test "z$(git config branch.myr12.remote)" = z &&
test "z$(git config branch.myr12.merge)" = z &&
test "z$(git config branch.myr12.rebase)" = z
@@ -1135,7 +1136,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '
git config branch.autosetuprebase never &&
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/master || git fetch local) &&
+ (git show-ref -q refs/remotes/loca