Skip to content

Commit b6211b8

Browse files
dschogitster
authored andcommitted
tests: avoid variations of the master branch name
The term `master` has a loaded history that serves as a constant reminder of racial injustice. The Git project has no desire to perpetuate this and already started avoiding it. The test suite uses variations of this name for branches other than the default one. Apart from t3200, where we just addressed this in the previous commit, those instances can be renamed in an automated manner because they do not require any changes outside of the test script, so let's do that. Seeing as the touched branches have very little (if anything) to do with the default branch, we choose to use a completely separate naming scheme: `topic_<number>` (it cannot be `topic-<number>` because t5515 uses the `test_oid` machinery with the term, and that machinery uses shell variables internally, whose names cannot contain dashes). This trick was performed by this (GNU) sed invocation: $ sed -i 's/master\([a-z0-9]\)/topic_\1/g' t/t*.sh Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 432f5e6 commit b6211b8

7 files changed

+58
-58
lines changed

t/t3427-rebase-subtree.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ commit_message() {
1515
# this test script tries to document them. First, the following commit history
1616
# is generated (the onelines are shown, time flows from left to right):
1717
#
18-
# master1 - master2 - master3
18+
# topic_1 - topic_2 - topic_3
1919
# \
20-
# README ---------------------- Add subproject master - master4 - files_subtree/master5
20+
# README ---------------------- Add subproject master - topic_4 - files_subtree/topic_5
2121
#
2222
# Where the merge moves the files master[123].t into the subdirectory
23-
# files_subtree/ and master4 as well as files_subtree/master5 add files to that
23+
# files_subtree/ and topic_4 as well as files_subtree/topic_5 add files to that
2424
# directory directly.
2525
#
2626
# Then, in subsequent test cases, `git filter-branch` is used to distill just
2727
# the commits that touch files_subtree/. To give it a final pre-rebase touch,
2828
# an empty commit is added on top. The pre-rebase commit history looks like
2929
# this:
3030
#
31-
# Add subproject master - master4 - files_subtree/master5 - Empty commit
31+
# Add subproject master - topic_4 - files_subtree/topic_5 - Empty commit
3232
#
33-
# where the root commit adds three files: master1.t, master2.t and master3.t.
33+
# where the root commit adds three files: topic_1.t, topic_2.t and topic_3.t.
3434
#
35-
# This commit history is then rebased onto `master3` with the
35+
# This commit history is then rebased onto `topic_3` with the
3636
# `-Xsubtree=files_subtree` option in three different ways:
3737
#
3838
# 1. using `--preserve-merges`
@@ -43,9 +43,9 @@ test_expect_success 'setup' '
4343
test_commit README &&
4444
4545
git init files &&
46-
test_commit -C files master1 &&
47-
test_commit -C files master2 &&
48-
test_commit -C files master3 &&
46+
test_commit -C files topic_1 &&
47+
test_commit -C files topic_2 &&
48+
test_commit -C files topic_3 &&
4949
5050
: perform subtree merge into files_subtree/ &&
5151
git fetch files refs/heads/master:refs/heads/files-master &&
@@ -55,8 +55,8 @@ test_expect_success 'setup' '
5555
git commit -m "Add subproject master" &&
5656
5757
: add two extra commits to rebase &&
58-
test_commit -C files_subtree master4 &&
59-
test_commit files_subtree/master5 &&
58+
test_commit -C files_subtree topic_4 &&
59+
test_commit files_subtree/topic_5 &&
6060
6161
git checkout -b to-rebase &&
6262
git fast-export --no-data HEAD -- files_subtree/ |
@@ -66,22 +66,22 @@ test_expect_success 'setup' '
6666
git commit -m "Empty commit" --allow-empty
6767
'
6868

69-
# FAILURE: Does not preserve master4.
69+
# FAILURE: Does not preserve topic_4.
7070
test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' '
7171
reset_rebase &&
7272
git checkout -b rebase-preserve-merges to-rebase &&
7373
git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
74-
verbose test "$(commit_message HEAD~)" = "master4" &&
75-
verbose test "$(commit_message HEAD)" = "files_subtree/master5"
74+
verbose test "$(commit_message HEAD~)" = "topic_4" &&
75+
verbose test "$(commit_message HEAD)" = "files_subtree/topic_5"
7676
'
7777

78-
# FAILURE: Does not preserve master4.
78+
# FAILURE: Does not preserve topic_4.
7979
test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' '
8080
reset_rebase &&
8181
git checkout -b rebase-keep-empty to-rebase &&
8282
git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
83-
verbose test "$(commit_message HEAD~2)" = "master4" &&
84-
verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
83+
verbose test "$(commit_message HEAD~2)" = "topic_4" &&
84+
verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
8585
verbose test "$(commit_message HEAD)" = "Empty commit"
8686
'
8787

@@ -91,8 +91,8 @@ test_expect_success 'Rebase -Xsubtree --empty=ask --onto commit' '
9191
test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --onto files-master master &&
9292
: first pick results in no changes &&
9393
git rebase --skip &&
94-
verbose test "$(commit_message HEAD~2)" = "master4" &&
95-
verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
94+
verbose test "$(commit_message HEAD~2)" = "topic_4" &&
95+
verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
9696
verbose test "$(commit_message HEAD)" = "Empty commit"
9797
'
9898

@@ -102,8 +102,8 @@ test_expect_success 'Rebase -Xsubtree --empty=ask --rebase-merges --onto commit'
102102
test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --rebase-merges --onto files-master --root &&
103103
: first pick results in no changes &&
104104
git rebase --skip &&
105-
verbose test "$(commit_message HEAD~2)" = "master4" &&
106-
verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
105+
verbose test "$(commit_message HEAD~2)" = "topic_4" &&
106+
verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
107107
verbose test "$(commit_message HEAD)" = "Empty commit"
108108
'
109109

t/t4150-am.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ test_expect_success 'am changes committer and keeps author' '
465465
test_expect_success 'am --signoff adds Signed-off-by: line' '
466466
rm -fr .git/rebase-apply &&
467467
git reset --hard &&
468-
git checkout -b master2 first &&
468+
git checkout -b topic_2 first &&
469469
git am --signoff <patch2 &&
470470
{
471471
printf "third\n\nSigned-off-by: %s <%s>\n\n" \
@@ -479,7 +479,7 @@ test_expect_success 'am --signoff adds Signed-off-by: line' '
479479
'
480480

481481
test_expect_success 'am stays in branch' '
482-
echo refs/heads/master2 >expected &&
482+
echo refs/heads/topic_2 >expected &&
483483
git symbolic-ref HEAD >actual &&
484484
test_cmp expected actual
485485
'
@@ -540,7 +540,7 @@ test_expect_success 'am without --keep removes Re: and [PATCH] stuff' '
540540
git reset --hard HEAD^ &&
541541
git am <patch4 &&
542542
git rev-parse HEAD >expected &&
543-
git rev-parse master2 >actual &&
543+
git rev-parse topic_2 >actual &&
544544
test_cmp expected actual
545545
'
546546

@@ -567,7 +567,7 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
567567
test_expect_success 'setup am -3' '
568568
rm -fr .git/rebase-apply &&
569569
git reset --hard &&
570-
git checkout -b base3way master2 &&
570+
git checkout -b base3way topic_2 &&
571571
sed -n -e "3,\$p" msg >file &&
572572
head -n 9 msg >>file &&
573573
git add file &&

t/t5515-fetch-merge-logic.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export GIT_TEST_PROTOCOL_VERSION
1515

1616
build_script () {
1717
script="$1" &&
18-
for i in one three_file master master2 one_tree three two two2 three2
18+
for i in one three_file master topic_2 one_tree three two two2 three2
1919
do
2020
echo "s/$(test_oid --hash=sha1 "$i")/$(test_oid "$i")/g" >>"$script"
2121
done
@@ -52,8 +52,8 @@ test_expect_success setup '
5252
two sha1:525b7fb068d59950d185a8779dc957c77eed73ba
5353
two sha256:3b21de3440cd38c2a9e9b464adb923f7054949ed4c918e1a0ac4c95cd52774db
5454
55-
master2 sha1:754b754407bf032e9a2f9d5a9ad05ca79a6b228f
56-
master2 sha256:6c7abaea8a6d8ef4d89877e68462758dc6774690fbbbb0e6d7dd57415c9abde0
55+
topic_2 sha1:754b754407bf032e9a2f9d5a9ad05ca79a6b228f
56+
topic_2 sha256:6c7abaea8a6d8ef4d89877e68462758dc6774690fbbbb0e6d7dd57415c9abde0
5757
5858
two2 sha1:6134ee8f857693b96ff1cc98d3e2fd62b199e5a8
5959
two2 sha256:87a2d3ee29c83a3dc7afd41c0606b11f67603120b910a7be7840accdc18344d4

t/t5523-push-upstream.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ test_expect_success 'push -u --dry-run master:otherX' '
4141
check_config master upstream refs/heads/other
4242
'
4343

44-
test_expect_success 'push -u master2:master2' '
45-
git branch master2 &&
46-
git push -u upstream master2:master2 &&
47-
check_config master2 upstream refs/heads/master2
44+
test_expect_success 'push -u topic_2:topic_2' '
45+
git branch topic_2 &&
46+
git push -u upstream topic_2:topic_2 &&
47+
check_config topic_2 upstream refs/heads/topic_2
4848
'
4949

50-
test_expect_success 'push -u master2:other2' '
51-
git push -u upstream master2:other2 &&
52-
check_config master2 upstream refs/heads/other2
50+
test_expect_success 'push -u topic_2:other2' '
51+
git push -u upstream topic_2:other2 &&
52+
check_config topic_2 upstream refs/heads/other2
5353
'
5454

55-
test_expect_success 'push -u :master2' '
56-
git push -u upstream :master2 &&
57-
check_config master2 upstream refs/heads/other2
55+
test_expect_success 'push -u :topic_2' '
56+
git push -u upstream :topic_2 &&
57+
check_config topic_2 upstream refs/heads/other2
5858
'
5959

6060
test_expect_success 'push -u --all' '

t/t6018-rev-list-glob.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ test_expect_success 'setup' '
3232
git checkout -b someref master &&
3333
commit some &&
3434
git checkout master &&
35-
commit master2 &&
35+
commit topic_2 &&
3636
git tag foo/bar master &&
37-
commit master3 &&
37+
commit topic_3 &&
3838
git update-ref refs/remotes/foo/baz master &&
39-
commit master4 &&
39+
commit topic_4 &&
4040
git update-ref refs/remotes/upstream/one subspace/one &&
4141
git update-ref refs/remotes/upstream/two subspace/two &&
4242
git update-ref refs/remotes/upstream/x subspace-x &&

t/t6040-tracking-info.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,25 +264,25 @@ test_expect_success 'fail to track annotated tags' '
264264
test_expect_success '--set-upstream-to does not change branch' '
265265
git branch from-master master &&
266266
git branch --set-upstream-to master from-master &&
267-
git branch from-master2 master &&
268-
test_must_fail git config branch.from-master2.merge > actual &&
269-
git rev-list from-master2 &&
270-
git update-ref refs/heads/from-master2 from-master2^ &&
271-
git rev-parse from-master2 >expect2 &&
272-
git branch --set-upstream-to master from-master2 &&
267+
git branch from-topic_2 master &&
268+
test_must_fail git config branch.from-topic_2.merge > actual &&
269+
git rev-list from-topic_2 &&
270+
git update-ref refs/heads/from-topic_2 from-topic_2^ &&
271+
git rev-parse from-topic_2 >expect2 &&
272+
git branch --set-upstream-to master from-topic_2 &&
273273
git config branch.from-master.merge > actual &&
274-
git rev-parse from-master2 >actual2 &&
274+
git rev-parse from-topic_2 >actual2 &&
275275
grep -q "^refs/heads/master$" actual &&
276276
cmp expect2 actual2
277277
'
278278

279279
test_expect_success '--set-upstream-to @{-1}' '
280280
git checkout follower &&
281-
git checkout from-master2 &&
282-
git config branch.from-master2.merge > expect2 &&
281+
git checkout from-topic_2 &&
282+
git config branch.from-topic_2.merge > expect2 &&
283283
git branch --set-upstream-to @{-1} from-master &&
284284
git config branch.from-master.merge > actual &&
285-
git config branch.from-master2.merge > actual2 &&
285+
git config branch.from-topic_2.merge > actual2 &&
286286
git branch --set-upstream-to follower from-master &&
287287
git config branch.from-master.merge > expect &&
288288
test_cmp expect2 actual2 &&

t/t6409-merge-subtree.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ test_expect_success 'merge update' '
9494
echo git-gui2 > git-gui.sh &&
9595
o3=$(git hash-object git-gui.sh) &&
9696
git add git-gui.sh &&
97-
git checkout -b master2 &&
97+
git checkout -b topic_2 &&
9898
git commit -m "update git-gui" &&
9999
cd ../git &&
100-
git pull -s subtree gui master2 &&
100+
git pull -s subtree gui topic_2 &&
101101
git ls-files -s >actual &&
102102
(
103103
echo "100644 $o3 0 git-gui/git-gui.sh" &&
@@ -109,7 +109,7 @@ test_expect_success 'merge update' '
109109
test_expect_success 'initial ambiguous subtree' '
110110
cd ../git &&
111111
git reset --hard master &&
112-
git checkout -b master2 &&
112+
git checkout -b topic_2 &&
113113
git merge -s ours --no-commit gui/master &&
114114
git read-tree --prefix=git-gui2/ -u gui/master &&
115115
git commit -m "Merge git-gui2 as our subdirectory" &&
@@ -125,8 +125,8 @@ test_expect_success 'initial ambiguous subtree' '
125125

126126
test_expect_success 'merge using explicit' '
127127
cd ../git &&
128-
git reset --hard master2 &&
129-
git pull -Xsubtree=git-gui gui master2 &&
128+
git reset --hard topic_2 &&
129+
git pull -Xsubtree=git-gui gui topic_2 &&
130130
git ls-files -s >actual &&
131131
(
132132
echo "100644 $o3 0 git-gui/git-gui.sh" &&
@@ -138,8 +138,8 @@ test_expect_success 'merge using explicit' '
138138

139139
test_expect_success 'merge2 using explicit' '
140140
cd ../git &&
141-
git reset --hard master2 &&
142-
git pull -Xsubtree=git-gui2 gui master2 &&
141+
git reset --hard topic_2 &&
142+
git pull -Xsubtree=git-gui2 gui topic_2 &&
143143
git ls-files -s >actual &&
144144
(
145145
echo "100644 $o1 0 git-gui/git-gui.sh" &&

0 commit comments

Comments
 (0)