mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'js/default-branch-name-part-4-minus-1'
Adjust tests so that they won't scream when the default initial branch name is changed to 'main'. * js/default-branch-name-part-4-minus-1: t1400: prepare for `main` being default branch name tests: prepare aligned mentions of the default branch name t9902: prepare a test for the upcoming default branch name t3200: prepare for `main` being shorter than `master` t5703: adjust a test case for the upcoming default branch name t6200: adjust suppression pattern to also match "main" tests: start moving to a different default main branch name t9801: use `--` in preparation for default branch rename fmt-merge-msg: also suppress "into main" by default
This commit is contained in:
commit
596ad33080
|
@ -626,8 +626,10 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
|
|||
void *current_branch_to_free;
|
||||
struct merge_parents merge_parents;
|
||||
|
||||
if (!suppress_dest_pattern_seen)
|
||||
if (!suppress_dest_pattern_seen) {
|
||||
string_list_append(&suppress_dest_patterns, "main");
|
||||
string_list_append(&suppress_dest_patterns, "master");
|
||||
}
|
||||
|
||||
memset(&merge_parents, 0, sizeof(merge_parents));
|
||||
|
||||
|
|
5
refs.c
5
refs.c
|
@ -567,8 +567,11 @@ char *repo_default_branch_name(struct repository *r)
|
|||
const char *config_key = "init.defaultbranch";
|
||||
const char *config_display_key = "init.defaultBranch";
|
||||
char *ret = NULL, *full_ref;
|
||||
const char *env = getenv("GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME");
|
||||
|
||||
if (repo_config_get_string(r, config_key, &ret) < 0)
|
||||
if (env && *env)
|
||||
ret = xstrdup(env);
|
||||
else if (repo_config_get_string(r, config_key, &ret) < 0)
|
||||
die(_("could not retrieve `%s`"), config_display_key);
|
||||
|
||||
if (!ret)
|
||||
|
|
|
@ -144,7 +144,7 @@ create_lib_submodule_repo () {
|
|||
git checkout -b valid_sub1 &&
|
||||
git revert HEAD &&
|
||||
|
||||
git checkout master
|
||||
git checkout "${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -553,14 +553,21 @@ test_expect_success '--initial-branch' '
|
|||
|
||||
test_expect_success 'overridden default initial branch name (config)' '
|
||||
test_config_global init.defaultBranch nmb &&
|
||||
git init initial-branch-config &&
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= git init initial-branch-config &&
|
||||
git -C initial-branch-config symbolic-ref HEAD >actual &&
|
||||
grep nmb actual
|
||||
'
|
||||
|
||||
test_expect_success 'overridden default main branch name (env)' '
|
||||
test_config_global init.defaultBranch nmb &&
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=env git init main-branch-env &&
|
||||
git -C main-branch-env symbolic-ref HEAD >actual &&
|
||||
grep env actual
|
||||
'
|
||||
|
||||
test_expect_success 'invalid default branch name' '
|
||||
test_config_global init.defaultBranch "with space" &&
|
||||
test_must_fail git init initial-branch-invalid 2>err &&
|
||||
test_must_fail env GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME="with space" \
|
||||
git init initial-branch-invalid 2>err &&
|
||||
test_i18ngrep "invalid branch name" err
|
||||
'
|
||||
|
||||
|
|
|
@ -585,10 +585,10 @@ test_expect_success 'stdin fails on unbalanced quotes' '
|
|||
grep "fatal: badly quoted argument: \\\"master" err
|
||||
'
|
||||
|
||||
test_expect_success 'stdin fails on invalid escape' '
|
||||
echo "create $a \"ma\zter\"" >stdin &&
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH '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\\\\zter\\\"" err
|
||||
grep "fatal: badly quoted argument: \\\"ma\\\\zn\\\"" err
|
||||
'
|
||||
|
||||
test_expect_success 'stdin fails on junk after quoted argument' '
|
||||
|
@ -704,9 +704,9 @@ test_expect_success 'stdin succeeds with quoted argument' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'stdin succeeds with escaped character' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'stdin succeeds with escaped character' '
|
||||
git update-ref -d $a &&
|
||||
echo "create $a \"ma\\163ter\"" >stdin &&
|
||||
echo "create $a \"ma\\151n\"" >stdin &&
|
||||
git update-ref --stdin <stdin &&
|
||||
git rev-parse $m >expect &&
|
||||
git rev-parse $a >actual &&
|
||||
|
|
|
@ -321,11 +321,11 @@ test_expect_success 'git branch --list -v with --abbrev' '
|
|||
|
||||
'
|
||||
|
||||
test_expect_success 'git branch --column' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch --column' '
|
||||
COLUMNS=81 git branch --column=column >actual &&
|
||||
cat >expect <<\EOF &&
|
||||
a/b/c bam foo l * master n o/p r
|
||||
abc bar j/k m/m mb o/o q topic
|
||||
a/b/c bam foo l * main n o/p r
|
||||
abc bar j/k m/m mb o/o q topic
|
||||
EOF
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -358,15 +358,15 @@ EOF
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'git branch with column.*' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch with column.*' '
|
||||
git config column.ui column &&
|
||||
git config column.branch "dense" &&
|
||||
COLUMNS=80 git branch >actual &&
|
||||
git config --unset column.branch &&
|
||||
git config --unset column.ui &&
|
||||
cat >expect <<\EOF &&
|
||||
a/b/c bam foo l * master n o/p r
|
||||
abc bar j/k m/m mb o/o q topic
|
||||
a/b/c bam foo l * main n o/p r
|
||||
abc bar j/k m/m mb o/o q topic
|
||||
EOF
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -375,9 +375,9 @@ test_expect_success 'git branch --column -v should fail' '
|
|||
test_must_fail git branch --column -v
|
||||
'
|
||||
|
||||
test_expect_success 'git branch -v with column.ui ignored' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch -v with column.ui ignored' '
|
||||
git config column.ui column &&
|
||||
COLUMNS=80 git branch -v | cut -c -9 | sed "s/ *$//" >actual &&
|
||||
COLUMNS=80 git branch -v | cut -c -8 | sed "s/ *$//" >actual &&
|
||||
git config --unset column.ui &&
|
||||
cat >expect <<\EOF &&
|
||||
a/b/c
|
||||
|
|
|
@ -242,7 +242,7 @@ test_expect_success 'branch --merged combined with --no-merged' '
|
|||
# Here "topic" tracks "master" with one extra commit, and "zzz" points to the
|
||||
# same tip as master The name "zzz" must come alphabetically after "topic"
|
||||
# as we process them in that order.
|
||||
test_expect_success 'branch --merged with --verbose' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'branch --merged with --verbose' '
|
||||
git branch --track topic master &&
|
||||
git branch zzz topic &&
|
||||
git checkout topic &&
|
||||
|
@ -256,9 +256,9 @@ test_expect_success 'branch --merged with --verbose' '
|
|||
test_cmp expect actual &&
|
||||
git branch --verbose --merged topic >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
master $(git rev-parse --short master) second on master
|
||||
* topic $(git rev-parse --short topic ) [ahead 1] foo
|
||||
zzz $(git rev-parse --short zzz ) second on master
|
||||
main $(git rev-parse --short main) second on main
|
||||
* topic $(git rev-parse --short topic ) [ahead 1] foo
|
||||
zzz $(git rev-parse --short zzz ) second on main
|
||||
EOF
|
||||
test_i18ncmp expect actual
|
||||
'
|
||||
|
|
|
@ -329,7 +329,7 @@ test_expect_success '--color overrides auto-color' '
|
|||
test_cmp expect.color actual
|
||||
'
|
||||
|
||||
test_expect_success 'verbose output lists worktree path' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'verbose output lists worktree path' '
|
||||
one=$(git rev-parse --short HEAD) &&
|
||||
two=$(git rev-parse --short master) &&
|
||||
cat >expect <<-EOF &&
|
||||
|
@ -337,7 +337,7 @@ test_expect_success 'verbose output lists worktree path' '
|
|||
ambiguous $one one
|
||||
branch-one $two two
|
||||
+ branch-two $one ($(pwd)/worktree_dir) one
|
||||
master $two two
|
||||
main $two two
|
||||
ref-to-branch $two two
|
||||
ref-to-remote $two two
|
||||
EOF
|
||||
|
|
|
@ -28,12 +28,12 @@ test_expect_success 'regular output shows colors' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'verbose output shows colors' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'verbose output shows colors' '
|
||||
oid=$(git rev-parse --short HEAD) &&
|
||||
cat >expect <<-EOF &&
|
||||
* <CYAN>master <RESET> $oid foo
|
||||
<BLUE>other <RESET> $oid foo
|
||||
<YELLOW>remotes/origin/master<RESET> $oid foo
|
||||
* <CYAN>main <RESET> $oid foo
|
||||
<BLUE>other <RESET> $oid foo
|
||||
<YELLOW>remotes/origin/main<RESET> $oid foo
|
||||
EOF
|
||||
git branch --color -v -a >actual.raw &&
|
||||
test_decode_color <actual.raw >actual &&
|
||||
|
|
|
@ -213,28 +213,28 @@ cat >test/expect <<EOF
|
|||
Push URL: $(pwd)/one
|
||||
HEAD branch: master
|
||||
Remote branches:
|
||||
master new (next fetch will store in remotes/origin)
|
||||
side tracked
|
||||
main new (next fetch will store in remotes/origin)
|
||||
side tracked
|
||||
Local branches configured for 'git pull':
|
||||
ahead merges with remote master
|
||||
master merges with remote master
|
||||
ahead merges with remote main
|
||||
main merges with remote main
|
||||
octopus merges with remote topic-a
|
||||
and with remote topic-b
|
||||
and with remote topic-c
|
||||
rebase rebases onto remote master
|
||||
Local refs configured for 'git push':
|
||||
master pushes to master (local out of date)
|
||||
master pushes to upstream (create)
|
||||
main pushes to main (local out of date)
|
||||
main pushes to upstream (create)
|
||||
* remote two
|
||||
Fetch URL: ../two
|
||||
Push URL: ../three
|
||||
HEAD branch: master
|
||||
Local refs configured for 'git push':
|
||||
ahead forces to master (fast-forwardable)
|
||||
master pushes to another (up to date)
|
||||
ahead forces to main (fast-forwardable)
|
||||
main pushes to another (up to date)
|
||||
EOF
|
||||
|
||||
test_expect_success 'show' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'show' '
|
||||
(
|
||||
cd test &&
|
||||
git config --add remote.origin.fetch refs/heads/master:refs/heads/upstream &&
|
||||
|
@ -277,15 +277,15 @@ cat >test/expect <<EOF
|
|||
master
|
||||
side
|
||||
Local branches configured for 'git pull':
|
||||
ahead merges with remote master
|
||||
master merges with remote master
|
||||
ahead merges with remote main
|
||||
main merges with remote main
|
||||
Local refs configured for 'git push' (status not queried):
|
||||
(matching) pushes to (matching)
|
||||
refs/heads/master pushes to refs/heads/upstream
|
||||
refs/heads/main pushes to refs/heads/upstream
|
||||
refs/tags/lastbackup forces to refs/tags/lastbackup
|
||||
EOF
|
||||
|
||||
test_expect_success 'show -n' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'show -n' '
|
||||
mv one one.unreachable &&
|
||||
(
|
||||
cd test &&
|
||||
|
@ -328,7 +328,7 @@ test_expect_success 'set-head --auto' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success 'set-head --auto has no problem w/multiple HEADs' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'set-head --auto has no problem w/multiple HEADs' '
|
||||
(
|
||||
cd test &&
|
||||
git fetch two "refs/heads/*:refs/remotes/two/*" &&
|
||||
|
@ -1348,7 +1348,7 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success 'refs/remotes/* <src> refspec and unqualified <dst> DWIM and advice' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'refs/remotes/* <src> refspec and unqualified <dst> DWIM and advice' '
|
||||
(
|
||||
cd two &&
|
||||
git tag -a -m "Some tag" my-tag master &&
|
||||
|
|
|
@ -942,7 +942,7 @@ test_expect_success 'fetching with auto-gc does not lock up' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH,C_LOCALE_OUTPUT 'fetch aligned output' '
|
||||
git clone . full-output &&
|
||||
test_commit looooooooooooong-tag &&
|
||||
(
|
||||
|
@ -951,13 +951,13 @@ test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' '
|
|||
grep -e "->" actual | cut -c 22- >../actual
|
||||
) &&
|
||||
cat >expect <<-\EOF &&
|
||||
master -> origin/master
|
||||
main -> origin/main
|
||||
looooooooooooong-tag -> looooooooooooong-tag
|
||||
EOF
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH,C_LOCALE_OUTPUT 'fetch compact output' '
|
||||
git clone . compact &&
|
||||
test_commit extraaa &&
|
||||
(
|
||||
|
@ -966,7 +966,7 @@ test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
|
|||
grep -e "->" actual | cut -c 22- >../actual
|
||||
) &&
|
||||
cat >expect <<-\EOF &&
|
||||
master -> origin/*
|
||||
main -> origin/*
|
||||
extraaa -> *
|
||||
EOF
|
||||
test_cmp expect actual
|
||||
|
|
|
@ -18,7 +18,7 @@ add_upstream_commit() {
|
|||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "Fetching submodule submodule" > ../expect.err &&
|
||||
echo "From $pwd/submodule" >> ../expect.err &&
|
||||
echo " $head1..$head2 master -> origin/master" >> ../expect.err
|
||||
echo " $head1..$head2 main -> origin/main" >> ../expect.err
|
||||
) &&
|
||||
(
|
||||
cd deepsubmodule &&
|
||||
|
@ -30,7 +30,7 @@ add_upstream_commit() {
|
|||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "Fetching submodule submodule/subdir/deepsubmodule" >> ../expect.err
|
||||
echo "From $pwd/deepsubmodule" >> ../expect.err &&
|
||||
echo " $head1..$head2 master -> origin/master" >> ../expect.err
|
||||
echo " $head1..$head2 main -> origin/main" >> ../expect.err
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ test_expect_success setup '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success "fetch --recurse-submodules recurses into submodules" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "fetch --recurse-submodules recurses into submodules" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -71,7 +71,7 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
|
|||
test_i18ncmp expect.err actual.err
|
||||
'
|
||||
|
||||
test_expect_success "submodule.recurse option triggers recursive fetch" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "submodule.recurse option triggers recursive fetch" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -81,7 +81,7 @@ test_expect_success "submodule.recurse option triggers recursive fetch" '
|
|||
test_i18ncmp expect.err actual.err
|
||||
'
|
||||
|
||||
test_expect_success "fetch --recurse-submodules -j2 has the same output behaviour" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "fetch --recurse-submodules -j2 has the same output behaviour" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -111,7 +111,7 @@ test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
|
|||
test_must_be_empty actual.err
|
||||
'
|
||||
|
||||
test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
|
||||
(
|
||||
cd downstream &&
|
||||
git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
|
||||
|
@ -141,7 +141,7 @@ test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides
|
|||
test_must_be_empty actual.err
|
||||
'
|
||||
|
||||
test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch --recurse-submodules >../actual.out 2>../actual.err &&
|
||||
|
@ -170,7 +170,7 @@ test_expect_success "--quiet propagates to parallel submodules" '
|
|||
test_must_be_empty actual.err
|
||||
'
|
||||
|
||||
test_expect_success "--dry-run propagates to submodules" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "--dry-run propagates to submodules" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -180,7 +180,7 @@ test_expect_success "--dry-run propagates to submodules" '
|
|||
test_i18ncmp expect.err actual.err
|
||||
'
|
||||
|
||||
test_expect_success "Without --dry-run propagates to submodules" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "Without --dry-run propagates to submodules" '
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch --recurse-submodules >../actual.out 2>../actual.err
|
||||
|
@ -189,7 +189,7 @@ test_expect_success "Without --dry-run propagates to submodules" '
|
|||
test_i18ncmp expect.err actual.err
|
||||
'
|
||||
|
||||
test_expect_success "recurseSubmodules=true propagates into submodules" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "recurseSubmodules=true propagates into submodules" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -200,7 +200,7 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
|
|||
test_i18ncmp expect.err actual.err
|
||||
'
|
||||
|
||||
test_expect_success "--recurse-submodules overrides config in submodule" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "--recurse-submodules overrides config in submodule" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -225,7 +225,7 @@ test_expect_success "--no-recurse-submodules overrides config setting" '
|
|||
test_must_be_empty actual.err
|
||||
'
|
||||
|
||||
test_expect_success "Recursion doesn't happen when no new commits are fetched in the superproject" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion doesn't happen when no new commits are fetched in the superproject" '
|
||||
(
|
||||
cd downstream &&
|
||||
(
|
||||
|
@ -239,13 +239,13 @@ test_expect_success "Recursion doesn't happen when no new commits are fetched in
|
|||
test_must_be_empty actual.err
|
||||
'
|
||||
|
||||
test_expect_success "Recursion stops when no new submodule commits are fetched" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion stops when no new submodule commits are fetched" '
|
||||
head1=$(git rev-parse --short HEAD) &&
|
||||
git add submodule &&
|
||||
git commit -m "new submodule" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err.sub &&
|
||||
echo " $head1..$head2 master -> origin/master" >>expect.err.sub &&
|
||||
echo " $head1..$head2 main -> origin/main" >>expect.err.sub &&
|
||||
head -3 expect.err >> expect.err.sub &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -255,7 +255,7 @@ test_expect_success "Recursion stops when no new submodule commits are fetched"
|
|||
test_must_be_empty actual.out
|
||||
'
|
||||
|
||||
test_expect_success "Recursion doesn't happen when new superproject commits don't change any submodules" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion doesn't happen when new superproject commits don't change any submodules" '
|
||||
add_upstream_commit &&
|
||||
head1=$(git rev-parse --short HEAD) &&
|
||||
echo a > file &&
|
||||
|
@ -263,7 +263,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
|
|||
git commit -m "new file" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err.file &&
|
||||
echo " $head1..$head2 master -> origin/master" >> expect.err.file &&
|
||||
echo " $head1..$head2 main -> origin/main" >> expect.err.file &&
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch >../actual.out 2>../actual.err
|
||||
|
@ -272,7 +272,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
|
|||
test_i18ncmp expect.err.file actual.err
|
||||
'
|
||||
|
||||
test_expect_success "Recursion picks up config in submodule" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion picks up config in submodule" '
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch --recurse-submodules &&
|
||||
|
@ -287,7 +287,7 @@ test_expect_success "Recursion picks up config in submodule" '
|
|||
git commit -m "new submodule" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err.sub &&
|
||||
echo " $head1..$head2 master -> origin/master" >> expect.err.sub &&
|
||||
echo " $head1..$head2 main -> origin/main" >> expect.err.sub &&
|
||||
cat expect.err >> expect.err.sub &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -301,7 +301,7 @@ test_expect_success "Recursion picks up config in submodule" '
|
|||
test_must_be_empty actual.out
|
||||
'
|
||||
|
||||
test_expect_success "Recursion picks up all submodules when necessary" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "Recursion picks up all submodules when necessary" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd submodule &&
|
||||
|
@ -316,14 +316,14 @@ test_expect_success "Recursion picks up all submodules when necessary" '
|
|||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "Fetching submodule submodule" > ../expect.err.sub &&
|
||||
echo "From $pwd/submodule" >> ../expect.err.sub &&
|
||||
echo " $head1..$head2 master -> origin/master" >> ../expect.err.sub
|
||||
echo " $head1..$head2 main -> origin/main" >> ../expect.err.sub
|
||||
) &&
|
||||
head1=$(git rev-parse --short HEAD) &&
|
||||
git add submodule &&
|
||||
git commit -m "new submodule" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err.2 &&
|
||||
echo " $head1..$head2 master -> origin/master" >> expect.err.2 &&
|
||||
echo " $head1..$head2 main -> origin/main" >> expect.err.2 &&
|
||||
cat expect.err.sub >> expect.err.2 &&
|
||||
tail -3 expect.err >> expect.err.2 &&
|
||||
(
|
||||
|
@ -334,7 +334,7 @@ test_expect_success "Recursion picks up all submodules when necessary" '
|
|||
test_must_be_empty actual.out
|
||||
'
|
||||
|
||||
test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
|
||||
add_upstream_commit &&
|
||||
(
|
||||
cd submodule &&
|
||||
|
@ -349,7 +349,7 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
|
|||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo Fetching submodule submodule > ../expect.err.sub &&
|
||||
echo "From $pwd/submodule" >> ../expect.err.sub &&
|
||||
echo " $head1..$head2 master -> origin/master" >> ../expect.err.sub
|
||||
echo " $head1..$head2 main -> origin/main" >> ../expect.err.sub
|
||||
) &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -361,14 +361,14 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
|
|||
test_must_be_empty actual.err
|
||||
'
|
||||
|
||||
test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
|
||||
head1=$(git rev-parse --short HEAD) &&
|
||||
git add submodule &&
|
||||
git commit -m "new submodule" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
tail -3 expect.err > expect.err.deepsub &&
|
||||
echo "From $pwd/." > expect.err &&
|
||||
echo " $head1..$head2 master -> origin/master" >>expect.err &&
|
||||
echo " $head1..$head2 main -> origin/main" >>expect.err &&
|
||||
cat expect.err.sub >> expect.err &&
|
||||
cat expect.err.deepsub >> expect.err &&
|
||||
(
|
||||
|
@ -389,7 +389,7 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
|
|||
test_i18ncmp expect.err actual.err
|
||||
'
|
||||
|
||||
test_expect_success "'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
|
||||
add_upstream_commit &&
|
||||
head1=$(git rev-parse --short HEAD) &&
|
||||
echo a >> file &&
|
||||
|
@ -397,7 +397,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
|
|||
git commit -m "new file" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err.file &&
|
||||
echo " $head1..$head2 master -> origin/master" >> expect.err.file &&
|
||||
echo " $head1..$head2 main -> origin/main" >> expect.err.file &&
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
|
||||
|
@ -406,7 +406,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
|
|||
test_i18ncmp expect.err.file actual.err
|
||||
'
|
||||
|
||||
test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "'fetch.recurseSubmodules=on-demand' overrides global config" '
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch --recurse-submodules
|
||||
|
@ -418,7 +418,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
|
|||
git commit -m "new submodule" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err.2 &&
|
||||
echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
|
||||
echo " $head1..$head2 main -> origin/main" >>expect.err.2 &&
|
||||
head -3 expect.err >> expect.err.2 &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -434,7 +434,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
|
|||
test_i18ncmp expect.err.2 actual.err
|
||||
'
|
||||
|
||||
test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch --recurse-submodules
|
||||
|
@ -446,7 +446,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
|
|||
git commit -m "new submodule" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err.2 &&
|
||||
echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
|
||||
echo " $head1..$head2 main -> origin/main" >>expect.err.2 &&
|
||||
head -3 expect.err >> expect.err.2 &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
@ -462,7 +462,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
|
|||
test_i18ncmp expect.err.2 actual.err
|
||||
'
|
||||
|
||||
test_expect_success "don't fetch submodule when newly recorded commits are already present" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "don't fetch submodule when newly recorded commits are already present" '
|
||||
(
|
||||
cd submodule &&
|
||||
git checkout -q HEAD^^
|
||||
|
@ -472,7 +472,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
|
|||
git commit -m "submodule rewound" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." > expect.err &&
|
||||
echo " $head1..$head2 master -> origin/master" >> expect.err &&
|
||||
echo " $head1..$head2 main -> origin/main" >> expect.err &&
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch >../actual.out 2>../actual.err
|
||||
|
@ -485,7 +485,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "'fetch.recurseSubmodules=on-demand' works also without .gitmodules entry" '
|
||||
(
|
||||
cd downstream &&
|
||||
git fetch --recurse-submodules
|
||||
|
@ -497,7 +497,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
|
|||
git commit -m "new submodule without .gitmodules" &&
|
||||
head2=$(git rev-parse --short HEAD) &&
|
||||
echo "From $pwd/." >expect.err.2 &&
|
||||
echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
|
||||
echo " $head1..$head2 main -> origin/main" >>expect.err.2 &&
|
||||
head -3 expect.err >>expect.err.2 &&
|
||||
(
|
||||
cd downstream &&
|
||||
|
|
|
@ -103,6 +103,7 @@ test_expect_success 'redirected clone -v does show progress' '
|
|||
|
||||
test_expect_success 'chooses correct default initial branch name' '
|
||||
git init --bare empty &&
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
|
||||
git -c init.defaultBranch=up clone empty whats-up &&
|
||||
test refs/heads/up = $(git -C whats-up symbolic-ref HEAD) &&
|
||||
test refs/heads/up = $(git -C whats-up config branch.up.merge)
|
||||
|
@ -117,9 +118,11 @@ test_expect_success 'guesses initial branch name correctly' '
|
|||
|
||||
git -c init.defaultBranch=none init --bare no-head &&
|
||||
git -C initial-branch push ../no-head guess abc &&
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
|
||||
git clone no-head is-it2 &&
|
||||
test_must_fail git -C is-it2 symbolic-ref refs/remotes/origin/HEAD &&
|
||||
git -C no-head update-ref --no-deref HEAD refs/heads/guess &&
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
|
||||
git -c init.defaultBranch=guess clone no-head is-it3 &&
|
||||
test refs/remotes/origin/guess = \
|
||||
$(git -C is-it3 symbolic-ref refs/remotes/origin/HEAD)
|
||||
|
|
|
@ -383,14 +383,14 @@ test_expect_success 'server is initially behind - ref in want' '
|
|||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'server loses a ref - ref in want' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'server loses a ref - ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
echo "s/master/raster/" >"$HTTPD_ROOT_PATH/one-time-perl" &&
|
||||
echo "s/main/rain/" >"$HTTPD_ROOT_PATH/one-time-perl" &&
|
||||
test_must_fail git -C local fetch 2>err &&
|
||||
|
||||
test_i18ngrep "fatal: remote error: unknown ref refs/heads/raster" err
|
||||
test_i18ngrep "fatal: remote error: unknown ref refs/heads/rain" err
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
|
|
|
@ -556,7 +556,7 @@ test_expect_success 'merge.suppressDest configuration' '
|
|||
head -n1 full.2 >actual &&
|
||||
grep -e "Merge branch .side. into master$" actual &&
|
||||
|
||||
git -c merge.suppressDest="ma??er" fmt-merge-msg <.git/FETCH_HEAD >full.3 &&
|
||||
git -c merge.suppressDest="ma?*[rn]" fmt-merge-msg <.git/FETCH_HEAD >full.3 &&
|
||||
head -n1 full.3 >actual &&
|
||||
grep -e "Merge branch .side." actual &&
|
||||
! grep -e " into master$" actual
|
||||
|
|
|
@ -113,9 +113,9 @@ test_expect_success '%(color) must fail' '
|
|||
test_must_fail git for-each-ref --format="%(color)%(refname)"
|
||||
'
|
||||
|
||||
test_expect_success 'left alignment is default' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'left alignment is default' '
|
||||
cat >expect <<-\EOF &&
|
||||
refname is refs/heads/master |refs/heads/master
|
||||
refname is refs/heads/main |refs/heads/main
|
||||
refname is refs/heads/side |refs/heads/side
|
||||
refname is refs/odd/spot |refs/odd/spot
|
||||
refname is refs/tags/annotated-tag|refs/tags/annotated-tag
|
||||
|
@ -131,9 +131,9 @@ test_expect_success 'left alignment is default' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'middle alignment' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'middle alignment' '
|
||||
cat >expect <<-\EOF &&
|
||||
| refname is refs/heads/master |refs/heads/master
|
||||
| refname is refs/heads/main |refs/heads/main
|
||||
| refname is refs/heads/side |refs/heads/side
|
||||
| refname is refs/odd/spot |refs/odd/spot
|
||||
|refname is refs/tags/annotated-tag|refs/tags/annotated-tag
|
||||
|
@ -149,9 +149,9 @@ test_expect_success 'middle alignment' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'right alignment' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'right alignment' '
|
||||
cat >expect <<-\EOF &&
|
||||
| refname is refs/heads/master|refs/heads/master
|
||||
| refname is refs/heads/main|refs/heads/main
|
||||
| refname is refs/heads/side|refs/heads/side
|
||||
| refname is refs/odd/spot|refs/odd/spot
|
||||
|refname is refs/tags/annotated-tag|refs/tags/annotated-tag
|
||||
|
@ -168,7 +168,7 @@ test_expect_success 'right alignment' '
|
|||
'
|
||||
|
||||
cat >expect <<-\EOF
|
||||
| refname is refs/heads/master |refs/heads/master
|
||||
| refname is refs/heads/main |refs/heads/main
|
||||
| refname is refs/heads/side |refs/heads/side
|
||||
| refname is refs/odd/spot |refs/odd/spot
|
||||
| refname is refs/tags/annotated-tag |refs/tags/annotated-tag
|
||||
|
@ -184,7 +184,7 @@ EOF
|
|||
test_align_permutations() {
|
||||
while read -r option
|
||||
do
|
||||
test_expect_success "align:$option" '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH "align:$option" '
|
||||
git for-each-ref --format="|%(align:$option)refname is %(refname)%(end)|%(refname)" >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
@ -213,9 +213,9 @@ EOF
|
|||
|
||||
# Individual atoms inside %(align:...) and %(end) must not be quoted.
|
||||
|
||||
test_expect_success 'alignment with format quote' "
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'alignment with format quote' "
|
||||
cat >expect <<-\EOF &&
|
||||
|' '\''master| A U Thor'\'' '|
|
||||
|' '\''main| A U Thor'\'' '|
|
||||
|' '\''side| A U Thor'\'' '|
|
||||
|' '\''odd/spot| A U Thor'\'' '|
|
||||
|' '\''annotated-tag| '\'' '|
|
||||
|
@ -231,9 +231,9 @@ test_expect_success 'alignment with format quote' "
|
|||
test_cmp expect actual
|
||||
"
|
||||
|
||||
test_expect_success 'nested alignment with quote formatting' "
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH 'nested alignment with quote formatting' "
|
||||
cat >expect <<-\EOF &&
|
||||
|' master '|
|
||||
|' main '|
|
||||
|' side '|
|
||||
|' odd/spot '|
|
||||
|' annotated-tag '|
|
||||
|
|
|
@ -67,7 +67,7 @@ test_expect_success 'import main, no branch detection' '
|
|||
(
|
||||
cd "$git" &&
|
||||
git log --oneline --graph --decorate --all &&
|
||||
git rev-list master >wc &&
|
||||
git rev-list master -- >wc &&
|
||||
test_line_count = 4 wc
|
||||
)
|
||||
'
|
||||
|
@ -78,7 +78,7 @@ test_expect_success 'import branch1, no branch detection' '
|
|||
(
|
||||
cd "$git" &&
|
||||
git log --oneline --graph --decorate --all &&
|
||||
git rev-list master >wc &&
|
||||
git rev-list master -- >wc &&
|
||||
test_line_count = 2 wc
|
||||
)
|
||||
'
|
||||
|
@ -89,7 +89,7 @@ test_expect_success 'import branch2, no branch detection' '
|
|||
(
|
||||
cd "$git" &&
|
||||
git log --oneline --graph --decorate --all &&
|
||||
git rev-list master >wc &&
|
||||
git rev-list master -- >wc &&
|
||||
test_line_count = 2 wc
|
||||
)
|
||||
'
|
||||
|
@ -100,7 +100,7 @@ test_expect_success 'import depot, no branch detection' '
|
|||
(
|
||||
cd "$git" &&
|
||||
git log --oneline --graph --decorate --all &&
|
||||
git rev-list master >wc &&
|
||||
git rev-list master -- >wc &&
|
||||
test_line_count = 8 wc
|
||||
)
|
||||
'
|
||||
|
@ -114,7 +114,7 @@ test_expect_success 'import depot, branch detection' '
|
|||
git log --oneline --graph --decorate --all &&
|
||||
|
||||
# 4 main commits
|
||||
git rev-list master >wc &&
|
||||
git rev-list master -- >wc &&
|
||||
test_line_count = 4 wc &&
|
||||
|
||||
# 3 main, 1 integrate, 1 on branch2
|
||||
|
@ -137,7 +137,7 @@ test_expect_success 'import depot, branch detection, branchList branch definitio
|
|||
git log --oneline --graph --decorate --all &&
|
||||
|
||||
# 4 main commits
|
||||
git rev-list master >wc &&
|
||||
git rev-list master -- >wc &&
|
||||
test_line_count = 4 wc &&
|
||||
|
||||
# 3 main, 1 integrate, 1 on branch2
|
||||
|
|
|
@ -1055,13 +1055,13 @@ test_expect_success 'teardown after filtering matching refs' '
|
|||
git -C otherrepo branch -D matching/branch-in-other
|
||||
'
|
||||
|
||||
test_expect_success '__git_refs - for-each-ref format specifiers in prefix' '
|
||||
test_expect_success PREPARE_FOR_MAIN_BRANCH '__git_refs - for-each-ref format specifiers in prefix' '
|
||||
cat >expected <<-EOF &&
|
||||
evil-%%-%42-%(refname)..master
|
||||
EOF
|
||||
(
|
||||
cur="evil-%%-%42-%(refname)..mas" &&
|
||||
__git_refs "" "" "evil-%%-%42-%(refname).." mas >"$actual"
|
||||
cur="evil-%%-%42-%(refname)..mai" &&
|
||||
__git_refs "" "" "evil-%%-%42-%(refname).." mai >"$actual"
|
||||
) &&
|
||||
test_cmp expected "$actual"
|
||||
'
|
||||
|
|
|
@ -1705,3 +1705,10 @@ test_lazy_prereq SHA1 '
|
|||
test_lazy_prereq REBASE_P '
|
||||
test -z "$GIT_TEST_SKIP_REBASE_P"
|
||||
'
|
||||
# Special-purpose prereq for transitioning to a new default branch name:
|
||||
# Some tests need more than just a mindless (case-preserving) s/master/main/g
|
||||
# replacement. The non-trivial adjustments are guarded behind this
|
||||
# prerequisite, acting kind of as a feature flag
|
||||
test_lazy_prereq PREPARE_FOR_MAIN_BRANCH '
|
||||
test "$GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME" = main
|
||||
'
|
||||
|
|
Loading…
Reference in a new issue