mbox series

[v2,0/2] Avoid main as branch name in the test suite

Message ID pull.743.v2.git.1602152027.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series Avoid main as branch name in the test suite | expand

Message

Philippe Blain via GitGitGadget Oct. 8, 2020, 10:13 a.m. UTC
In preparation for changing the default branch name to main, let's stop
using it as non-default branch name in the test suite.

This is the last preparatory step before the patch series that intends to
change the default branch name to main. See 
https://github.com/gitgitgadget/git/pull/655 for the entire game plan.

Changes since v1:

 * The commit message of the t1415 patch elaborates a but more about the
   rationale for the change.
 * Instead of primary, the second patch renames all of those branches to 
   topic, imitating b6211b89eb3 (tests: avoid variations of the master 
   branch name, 2020-09-26).

Johannes Schindelin (2):
  t1415: avoid using `main` as ref name
  tests: avoid using the branch name `main`

 t/t1415-worktree-refs.sh     | 18 +++++++++---------
 t/t6012-rev-list-simplify.sh |  8 ++++----
 t/t6400-merge-df.sh          |  8 ++++----
 t/t6409-merge-subtree.sh     | 12 ++++++------
 t/t6430-merge-recursive.sh   |  4 ++--
 5 files changed, 25 insertions(+), 25 deletions(-)


base-commit: 306ee63a703ad67c54ba1209dc11dd9ea500dc1f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-743%2Fdscho%2Favoid-main-as-branch-name-in-tests-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-743/dscho/avoid-main-as-branch-name-in-tests-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/743

Range-diff vs v1:

 1:  d3f7b39a2f ! 1:  2c6f41f9ad t1415: avoid using `main` as ref name
     @@ Commit message
          `init.defaultBranch` to `main`, let's not use `main` as ref name in this
          test script.
      
     -    Since we already use the name "second" for a secondary worktree that is
     -    created in this test, let's use the name "first" for those refs instead.
     +    Otherwise, the `git for-each-ref ... | grep main` which wants to catch
     +    those refs would also unexpectedly catch `refs/heads/main`.
      
     -    While at it, adjust the test titles where "repo" was used by mistake
     -    instead of the term "worktree".
     +    Since the refs in question are worktree-local ones (i.e. each worktree
     +    has their own, just like `HEAD`), and since the test case already uses a
     +    secondary worktree called "second", let's use the name "first" for those
     +    refs instead.
     +
     +    While at it, adjust the test titles that talk about a "repo" when they
     +    meant a "worktree" instead.
      
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
 2:  6045ceb938 ! 2:  b187571778 tests: avoid using the branch name `main`
     @@ Commit message
      
          In the near future, we want to change Git's default branch name to
          `main`. In preparation for that, stop using it as a branch name in the
     -    test suite. Replace that branch name by `primary`.
     +    test suite. Replace that branch name by `topic`, the same name we used
     +    to rename variations of `master` in b6211b89eb3 (tests: avoid variations
     +    of the `master` branch name, 2020-09-26).
      
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
     @@ t/t6012-rev-list-simplify.sh: test_expect_success '--full-diff is not affected b
       	rm -rf .git * &&
       	git init &&
      -	git switch -c main &&
     -+	git switch -c primary &&
     ++	git switch -c topic &&
       
       	echo base >file &&
       	git add file &&
     @@ t/t6012-rev-list-simplify.sh: test_expect_success 'rebuild repo' '
       	test_commit B &&
       
      -	git switch main &&
     -+	git switch primary &&
     ++	git switch topic &&
       	test_must_fail git merge -m "M" B &&
       	echo A >file &&
       	echo B >>file &&
     @@ t/t6012-rev-list-simplify.sh: test_expect_success 'rebuild repo' '
       	note R &&
       
      -	git switch main &&
     -+	git switch primary &&
     ++	git switch topic &&
       	git merge -m N R &&
       	note N &&
       
     @@ t/t6012-rev-list-simplify.sh: test_expect_success 'rebuild repo' '
       	test_commit Z &&
       
      -	git switch main &&
     -+	git switch primary &&
     ++	git switch topic &&
       	git merge -m O Z &&
       	note O &&
       
     @@ t/t6400-merge-df.sh: test_expect_success 'Simple merge in repo with interesting
       		git commit -m initial &&
       
      -		git branch main &&
     -+		git branch primary &&
     ++		git branch topic &&
       		git branch other &&
       
       		git checkout other &&
     @@ t/t6400-merge-df.sh: test_expect_success 'Simple merge in repo with interesting
       
      -		git checkout main &&
      -		echo main >foo/bar/baz &&
     -+		git checkout primary &&
     -+		echo primary >foo/bar/baz &&
     ++		git checkout topic &&
     ++		echo topic >foo/bar/baz &&
       		git add -u &&
      -		git commit -m main &&
     -+		git commit -m primary &&
     ++		git commit -m topic &&
       
       		git merge other &&
       		git ls-files -s >out &&
     @@ t/t6409-merge-subtree.sh: test_expect_success 'setup branch sub' '
       
      -test_expect_success 'setup branch main' '
      -	git checkout -b main master &&
     -+test_expect_success 'setup branch primary' '
     -+	git checkout -b primary master &&
     ++test_expect_success 'setup topic branch' '
     ++	git checkout -b topic master &&
       	git merge -s ours --no-commit --allow-unrelated-histories sub &&
       	git read-tree --prefix=dir/ -u sub &&
      -	git commit -m "initial merge of sub into main" &&
     -+	git commit -m "initial merge of sub into primary" &&
     ++	git commit -m "initial merge of sub into topic" &&
       	test_path_is_file dir/foo.t &&
       	test_path_is_file hello
       '
     @@ t/t6409-merge-subtree.sh: test_expect_success 'update branch sub' '
      -test_expect_success 'update branch main' '
      -	git checkout main &&
      -	git merge -s subtree sub -m "second merge of sub into main" &&
     -+test_expect_success 'update branch primary' '
     -+	git checkout primary &&
     -+	git merge -s subtree sub -m "second merge of sub into primary" &&
     ++test_expect_success 'update topic branch' '
     ++	git checkout topic &&
     ++	git merge -s subtree sub -m "second merge of sub into topic" &&
       	test_path_is_file dir/bar.t &&
       	test_path_is_file dir/foo.t &&
       	test_path_is_file hello
     @@ t/t6430-merge-recursive.sh: test_expect_failure 'merge-recursive rename vs. rena
       test_expect_success 'merging with triple rename across D/F conflict' '
       	git reset --hard HEAD &&
      -	git checkout -b main &&
     -+	git checkout -b primary &&
     ++	git checkout -b topic &&
       	git rm -rf . &&
       
       	echo "just a file" >sub1 &&
     @@ t/t6430-merge-recursive.sh: test_expect_success 'merging with triple rename acro
       	git commit -a -m changesimplefile &&
       
      -	git checkout main &&
     -+	git checkout primary &&
     ++	git checkout topic &&
       	git rm sub1 &&
       	git mv sub2 sub1 &&
       	test_tick &&