From 2217230d53ab6d3c6b61fc996a8394cbf8c7fce9 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 13:59:58 +0000 Subject: fmt-merge-msg: also suppress "into main" by default In preparation for changing the default branch name to `main`, let's skip the suffix "into main" in merge commit messages, the same way that "into master" has been skipped by default. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c index bd22e1e..9a664a4 100644 --- a/fmt-merge-msg.c +++ b/fmt-merge-msg.c @@ -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)); -- cgit v0.10.2-6-g49f6 From 25ad0dc1307412bb25344db017c0e942529cbd6d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 13:59:59 +0000 Subject: t9801: use `--` in preparation for default branch rename Seeing as we want to use `main` as the new default branch name used by `git init`, and that `main` is used as directory name in t9801, let's tighten the rev-list arguments to make it explicit when we are referring to a ref instead of a directory. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh index 67ff271..a3abd77 100755 --- a/t/t9801-git-p4-branch.sh +++ b/t/t9801-git-p4-branch.sh @@ -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 -- cgit v0.10.2-6-g49f6 From 704fed9ea22230929639c9e5fca122045f84311d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 14:00:00 +0000 Subject: tests: start moving to a different default main branch name To allow for an incremental conversion to a new default main branch name, let's introduce `GIT_TEST_DEFAULT_MAIN_BRANCH_NAME`. This environment variable can be set at the top of each converted test script, overriding the default main branch name to use when initializing new repositories (or cloning empty repositories). Note: the `GIT_TEST_DEFAULT_MAIN_BRANCH_NAME` is _not_ intended to be used manually; many tests require a specific main branch name and cannot simply work with another one. This `GIT_TEST_*` variable is meant purely for the transitional period while the entire test suite is converted to use `main` as the initial branch name by default. We also introduce the `PREPARE_FOR_MAIN_BRANCH` prereq that determines whether the default main branch name is `main`, and adjust a couple of test functions to use it. This prereq will be used to temporarily disable a couple test cases to allow for adjusting the test script incrementally. Once an entire test is adjusted, we will adjust the test so that it is run with `GIT_TEST_DEFAULT_MAIN_BRANCH_NAME=main`. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/refs.c b/refs.c index fa01153..392f0bb 100644 --- a/refs.c +++ b/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) diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 87a7591..bd3fa3c 100644 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -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}" ) } diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 2f7c3dc..69a3204 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -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 ' diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh index e69427f..856eebf 100755 --- a/t/t5606-clone-options.sh +++ b/t/t5606-clone-options.sh @@ -37,6 +37,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) @@ -51,9 +52,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) diff --git a/t/test-lib.sh b/t/test-lib.sh index ef31f40..6b35070 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1702,3 +1702,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 +' -- cgit v0.10.2-6-g49f6 From 392ab3d9ff78658b2e456eede3ebeaec9d89197f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 14:00:01 +0000 Subject: t6200: adjust suppression pattern to also match "main" In preparation to running t6200 with the default branch name set to "main", let's adjust the only non-trivial aspect thereof. The rest will be done via a trivial `sed` invocation. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh index 7d54974..f3e66ea 100755 --- a/t/t6200-fmt-merge-msg.sh +++ b/t/t6200-fmt-merge-msg.sh @@ -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 -- cgit v0.10.2-6-g49f6 From 97cf8d50b598105ecc383bec8fd9b8699e7ba51f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 14:00:02 +0000 Subject: t5703: adjust a test case for the upcoming default branch name We want to rename the default branch name used by `git init` in the near future, using `main` as the new name. In preparation for that, we adjust a test case that wants to rename the default branch to a different name that however has the same length. We use `none` as that name because it matches the length of `main`. As this test case cannot possibly pass until the default branch name is _actually_ changed, we temporarily guard it behind a special-purpose prereq, until the test suite is fully converted to use that new default branch name. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh index d9ecf0f..b46940b 100755 --- a/t/t5703-upload-pack-ref-in-want.sh +++ b/t/t5703-upload-pack-ref-in-want.sh @@ -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 -- cgit v0.10.2-6-g49f6 From 56300ff356bfa595c7d407323db1fb4cf279e2a7 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 14:00:03 +0000 Subject: t3200: prepare for `main` being shorter than `master` In the test case adjusted by this patch, we want to cut just after the longest shown ref name. Since `main` is shorter than `master`, we need to decrease the number of characters. Since `topic` is shown, too, and since that is only one character shorter than `master`, we decrement the length by one instead of two. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 6efe7a4..55b24b7 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -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 -- cgit v0.10.2-6-g49f6 From 8164360fc8631d4090486b42e283c742a84887f8 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 14:00:04 +0000 Subject: t9902: prepare a test for the upcoming default branch name We need to adjust a test that uses a prefix of the default branch name, to accommodate for `main` being used soon. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 7b7bc6e..0badcf8 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -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" ' -- cgit v0.10.2-6-g49f6 From 66713e84e713066f4984efdd1444a7567c4d9bde Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 14:00:05 +0000 Subject: tests: prepare aligned mentions of the default branch name In some tests, the default branch name is part of aligned output. As we want to change the default branch name to `main`, which is two characters shorter than the old default branch name, we will have to adjust those tests. Since we use the original default branch name until the entire test suite has been adjusted accordingly, the touched test cases need to be guarded by a prereq (that is so far disabled so that they are skipped for now). The test cases that depend on those test cases that are newly guarded by that prereq naturally have to be guarded, too. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 55b24b7..a0b832d 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -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 ' diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh index efea5c4..3733cd0 100755 --- a/t/t3201-branch-contains.sh +++ b/t/t3201-branch-contains.sh @@ -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 ' diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index 71818b9..d655865 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -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 diff --git a/t/t3205-branch-color.sh b/t/t3205-branch-color.sh index 4f1e16b..289625c 100755 --- a/t/t3205-branch-color.sh +++ b/t/t3205-branch-color.sh @@ -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 && - * master $oid foo - other $oid foo - remotes/origin/master $oid foo + * main $oid foo + other $oid foo + remotes/origin/main $oid foo EOF git branch --color -v -a >actual.raw && test_decode_color actual && diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 8d62edd..de0e3df 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -200,28 +200,28 @@ cat >test/expect <test/expect < refspec DWIM and advice' ' ) ' -test_expect_success 'refs/remotes/* refspec and unqualified DWIM and advice' ' +test_expect_success PREPARE_FOR_MAIN_BRANCH 'refs/remotes/* refspec and unqualified DWIM and advice' ' ( cd two && git tag -a -m "Some tag" my-tag master && diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index dbc724e..5d67335 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -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 diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh index 63205df..dd8e423 100755 --- a/t/t5526-fetch-submodules.sh +++ b/t/t5526-fetch-submodules.sh @@ -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..fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" ' +test_expect_success PREPARE_FOR_MAIN_BRANCH "'submodule..fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" ' ( cd downstream && git fetch --recurse-submodules @@ -446,7 +446,7 @@ test_expect_success "'submodule..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..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 && diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh index 781e470..0a21669 100755 --- a/t/t6302-for-each-ref-filter.sh +++ b/t/t6302-for-each-ref-filter.sh @@ -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 '| -- cgit v0.10.2-6-g49f6 From 3224b0f0bb7bc90c0156e73c58f1d2e770f0ad7c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Oct 2020 14:00:06 +0000 Subject: t1400: prepare for `main` being default branch name In addition to the trivial search-and-replace, there are three non-trivial adjustments necessary. Mark the respective test cases with the transitional prereq and make those non-trivial adjustments early, to make this change easier to review. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 770e7be..4c01e08 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -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 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 expect && git rev-parse $a >actual && -- cgit v0.10.2-6-g49f6