@matheusbsbs / matheus-bagliano / commits / b6211b89eb
Fork 0

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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Sep 26, 2020 at 21:04 UTC b6211b89eb3aee35afdcb1788869b5cf4b04a850
7 files changed +58 -58
t/t3427-rebase-subtree.sh
+21 -21
@@ -15,12 +15,12 @@ commit_message() {
15 # this test script tries to document them. First, the following commit history
16 # is generated (the onelines are shown, time flows from left to right):
17 #
18 -# master1 - master2 - master3
18 +# topic_1 - topic_2 - topic_3
19 # \
20 -# README ---------------------- Add subproject master - master4 - files_subtree/master5
20 +# README ---------------------- Add subproject master - topic_4 - files_subtree/topic_5
21 #
22 # 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
24 # directory directly.
25 #
26 # Then, in subsequent test cases, `git filter-branch` is used to distill just
@@ -28,11 +28,11 @@ commit_message() {
28 # an empty commit is added on top. The pre-rebase commit history looks like
29 # this:
30 #
31 -# Add subproject master - master4 - files_subtree/master5 - Empty commit
31 +# Add subproject master - topic_4 - files_subtree/topic_5 - Empty commit
32 #
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.
34 #
35 -# This commit history is then rebased onto `master3` with the
35 +# This commit history is then rebased onto `topic_3` with the
36 # `-Xsubtree=files_subtree` option in three different ways:
37 #
38 # 1. using `--preserve-merges`
@@ -43,9 +43,9 @@ test_expect_success 'setup' '
43 test_commit README &&
44
45 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 &&
49
50 : perform subtree merge into files_subtree/ &&
51 git fetch files refs/heads/master:refs/heads/files-master &&
@@ -55,8 +55,8 @@ test_expect_success 'setup' '
55 git commit -m "Add subproject master" &&
56
57 : 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 &&
60
61 git checkout -b to-rebase &&
62 git fast-export --no-data HEAD -- files_subtree/ |
@@ -66,22 +66,22 @@ test_expect_success 'setup' '
66 git commit -m "Empty commit" --allow-empty
67 '
68
69 -# FAILURE: Does not preserve master4.
69 +# FAILURE: Does not preserve topic_4.
70 test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' '
71 reset_rebase &&
72 git checkout -b rebase-preserve-merges to-rebase &&
73 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"
76 '
77
78 -# FAILURE: Does not preserve master4.
78 +# FAILURE: Does not preserve topic_4.
79 test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' '
80 reset_rebase &&
81 git checkout -b rebase-keep-empty to-rebase &&
82 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" &&
85 verbose test "$(commit_message HEAD)" = "Empty commit"
86 '
87
@@ -91,8 +91,8 @@ test_expect_success 'Rebase -Xsubtree --empty=ask --onto commit' '
91 test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --onto files-master master &&
92 : first pick results in no changes &&
93 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" &&
96 verbose test "$(commit_message HEAD)" = "Empty commit"
97 '
98
@@ -102,8 +102,8 @@ test_expect_success 'Rebase -Xsubtree --empty=ask --rebase-merges --onto commit'
102 test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --rebase-merges --onto files-master --root &&
103 : first pick results in no changes &&
104 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" &&
107 verbose test "$(commit_message HEAD)" = "Empty commit"
108 '
109
t/t4150-am.sh
+4 -4
@@ -465,7 +465,7 @@ test_expect_success 'am changes committer and keeps author' '
465 test_expect_success 'am --signoff adds Signed-off-by: line' '
466 rm -fr .git/rebase-apply &&
467 git reset --hard &&
468 - git checkout -b master2 first &&
468 + git checkout -b topic_2 first &&
469 git am --signoff <patch2 &&
470 {
471 printf "third\n\nSigned-off-by: %s <%s>\n\n" \
@@ -479,7 +479,7 @@ test_expect_success 'am --signoff adds Signed-off-by: line' '
479 '
480
481 test_expect_success 'am stays in branch' '
482 - echo refs/heads/master2 >expected &&
482 + echo refs/heads/topic_2 >expected &&
483 git symbolic-ref HEAD >actual &&
484 test_cmp expected actual
485 '
@@ -540,7 +540,7 @@ test_expect_success 'am without --keep removes Re: and [PATCH] stuff' '
540 git reset --hard HEAD^ &&
541 git am <patch4 &&
542 git rev-parse HEAD >expected &&
543 - git rev-parse master2 >actual &&
543 + git rev-parse topic_2 >actual &&
544 test_cmp expected actual
545 '
546
@@ -567,7 +567,7 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
567 test_expect_success 'setup am -3' '
568 rm -fr .git/rebase-apply &&
569 git reset --hard &&
570 - git checkout -b base3way master2 &&
570 + git checkout -b base3way topic_2 &&
571 sed -n -e "3,\$p" msg >file &&
572 head -n 9 msg >>file &&
573 git add file &&
t/t5515-fetch-merge-logic.sh
+3 -3
@@ -15,7 +15,7 @@ export GIT_TEST_PROTOCOL_VERSION
15
16 build_script () {
17 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
19 do
20 echo "s/$(test_oid --hash=sha1 "$i")/$(test_oid "$i")/g" >>"$script"
21 done
@@ -52,8 +52,8 @@ test_expect_success setup '
52 two sha1:525b7fb068d59950d185a8779dc957c77eed73ba
53 two sha256:3b21de3440cd38c2a9e9b464adb923f7054949ed4c918e1a0ac4c95cd52774db
54
55 - master2 sha1:754b754407bf032e9a2f9d5a9ad05ca79a6b228f
56 - master2 sha256:6c7abaea8a6d8ef4d89877e68462758dc6774690fbbbb0e6d7dd57415c9abde0
55 + topic_2 sha1:754b754407bf032e9a2f9d5a9ad05ca79a6b228f
56 + topic_2 sha256:6c7abaea8a6d8ef4d89877e68462758dc6774690fbbbb0e6d7dd57415c9abde0
57
58 two2 sha1:6134ee8f857693b96ff1cc98d3e2fd62b199e5a8
59 two2 sha256:87a2d3ee29c83a3dc7afd41c0606b11f67603120b910a7be7840accdc18344d4
t/t5523-push-upstream.sh
+10 -10
@@ -41,20 +41,20 @@ test_expect_success 'push -u --dry-run master:otherX' '
41 check_config master upstream refs/heads/other
42 '
43
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
48 '
49
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
53 '
54
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
58 '
59
60 test_expect_success 'push -u --all' '
t/t6018-rev-list-glob.sh
+3 -3
@@ -32,11 +32,11 @@ test_expect_success 'setup' '
32 git checkout -b someref master &&
33 commit some &&
34 git checkout master &&
35 - commit master2 &&
35 + commit topic_2 &&
36 git tag foo/bar master &&
37 - commit master3 &&
37 + commit topic_3 &&
38 git update-ref refs/remotes/foo/baz master &&
39 - commit master4 &&
39 + commit topic_4 &&
40 git update-ref refs/remotes/upstream/one subspace/one &&
41 git update-ref refs/remotes/upstream/two subspace/two &&
42 git update-ref refs/remotes/upstream/x subspace-x &&
t/t6040-tracking-info.sh
+10 -10
@@ -264,25 +264,25 @@ test_expect_success 'fail to track annotated tags' '
264 test_expect_success '--set-upstream-to does not change branch' '
265 git branch from-master master &&
266 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 &&
273 git config branch.from-master.merge > actual &&
274 - git rev-parse from-master2 >actual2 &&
274 + git rev-parse from-topic_2 >actual2 &&
275 grep -q "^refs/heads/master$" actual &&
276 cmp expect2 actual2
277 '
278
279 test_expect_success '--set-upstream-to @{-1}' '
280 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 &&
283 git branch --set-upstream-to @{-1} from-master &&
284 git config branch.from-master.merge > actual &&
285 - git config branch.from-master2.merge > actual2 &&
285 + git config branch.from-topic_2.merge > actual2 &&
286 git branch --set-upstream-to follower from-master &&
287 git config branch.from-master.merge > expect &&
288 test_cmp expect2 actual2 &&
t/t6409-merge-subtree.sh
+7 -7
@@ -94,10 +94,10 @@ test_expect_success 'merge update' '
94 echo git-gui2 > git-gui.sh &&
95 o3=$(git hash-object git-gui.sh) &&
96 git add git-gui.sh &&
97 - git checkout -b master2 &&
97 + git checkout -b topic_2 &&
98 git commit -m "update git-gui" &&
99 cd ../git &&
100 - git pull -s subtree gui master2 &&
100 + git pull -s subtree gui topic_2 &&
101 git ls-files -s >actual &&
102 (
103 echo "100644 $o3 0 git-gui/git-gui.sh" &&
@@ -109,7 +109,7 @@ test_expect_success 'merge update' '
109 test_expect_success 'initial ambiguous subtree' '
110 cd ../git &&
111 git reset --hard master &&
112 - git checkout -b master2 &&
112 + git checkout -b topic_2 &&
113 git merge -s ours --no-commit gui/master &&
114 git read-tree --prefix=git-gui2/ -u gui/master &&
115 git commit -m "Merge git-gui2 as our subdirectory" &&
@@ -125,8 +125,8 @@ test_expect_success 'initial ambiguous subtree' '
125
126 test_expect_success 'merge using explicit' '
127 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 &&
130 git ls-files -s >actual &&
131 (
132 echo "100644 $o3 0 git-gui/git-gui.sh" &&
@@ -138,8 +138,8 @@ test_expect_success 'merge using explicit' '
138
139 test_expect_success 'merge2 using explicit' '
140 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 &&
143 git ls-files -s >actual &&
144 (
145 echo "100644 $o1 0 git-gui/git-gui.sh" &&