2
2
3
3
test_description=' branch --contains <commit>, --no-contains <commit> --merged, and --no-merged'
4
4
5
- GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
7
8
8
. ./test-lib.sh
@@ -17,47 +17,47 @@ test_expect_success setup '
17
17
18
18
echo 1 >file &&
19
19
test_tick &&
20
- git commit -a -m "second on master " &&
20
+ git commit -a -m "second on main " &&
21
21
22
22
git checkout side &&
23
23
echo 1 >file &&
24
24
test_tick &&
25
25
git commit -a -m "second on side" &&
26
26
27
- git merge master
27
+ git merge main
28
28
29
29
'
30
30
31
- test_expect_success ' branch --contains=master ' '
31
+ test_expect_success ' branch --contains=main ' '
32
32
33
- git branch --contains=master >actual &&
33
+ git branch --contains=main >actual &&
34
34
{
35
- echo " master " && echo "* side"
35
+ echo " main " && echo "* side"
36
36
} >expect &&
37
37
test_cmp expect actual
38
38
39
39
'
40
40
41
- test_expect_success ' branch --contains master ' '
41
+ test_expect_success ' branch --contains main ' '
42
42
43
- git branch --contains master >actual &&
43
+ git branch --contains main >actual &&
44
44
{
45
- echo " master " && echo "* side"
45
+ echo " main " && echo "* side"
46
46
} >expect &&
47
47
test_cmp expect actual
48
48
49
49
'
50
50
51
- test_expect_success ' branch --no-contains=master ' '
51
+ test_expect_success ' branch --no-contains=main ' '
52
52
53
- git branch --no-contains=master >actual &&
53
+ git branch --no-contains=main >actual &&
54
54
test_must_be_empty actual
55
55
56
56
'
57
57
58
- test_expect_success ' branch --no-contains master ' '
58
+ test_expect_success ' branch --no-contains main ' '
59
59
60
- git branch --no-contains master >actual &&
60
+ git branch --no-contains main >actual &&
61
61
test_must_be_empty actual
62
62
63
63
'
@@ -76,25 +76,25 @@ test_expect_success 'branch --no-contains=side' '
76
76
77
77
git branch --no-contains=side >actual &&
78
78
{
79
- echo " master "
79
+ echo " main "
80
80
} >expect &&
81
81
test_cmp expect actual
82
82
83
83
'
84
84
85
85
test_expect_success ' branch --contains with pattern implies --list' '
86
86
87
- git branch --contains=master master >actual &&
87
+ git branch --contains=main main >actual &&
88
88
{
89
- echo " master "
89
+ echo " main "
90
90
} >expect &&
91
91
test_cmp expect actual
92
92
93
93
'
94
94
95
95
test_expect_success ' branch --no-contains with pattern implies --list' '
96
96
97
- git branch --no-contains=master master >actual &&
97
+ git branch --no-contains=main main >actual &&
98
98
test_must_be_empty actual
99
99
100
100
'
@@ -103,7 +103,7 @@ test_expect_success 'side: branch --merged' '
103
103
104
104
git branch --merged >actual &&
105
105
{
106
- echo " master " &&
106
+ echo " main " &&
107
107
echo "* side"
108
108
} >expect &&
109
109
test_cmp expect actual
@@ -112,9 +112,9 @@ test_expect_success 'side: branch --merged' '
112
112
113
113
test_expect_success ' branch --merged with pattern implies --list' '
114
114
115
- git branch --merged=side master >actual &&
115
+ git branch --merged=side main >actual &&
116
116
{
117
- echo " master "
117
+ echo " main "
118
118
} >expect &&
119
119
test_cmp expect actual
120
120
@@ -127,18 +127,18 @@ test_expect_success 'side: branch --no-merged' '
127
127
128
128
'
129
129
130
- test_expect_success ' master : branch --merged' '
130
+ test_expect_success ' main : branch --merged' '
131
131
132
- git checkout master &&
132
+ git checkout main &&
133
133
git branch --merged >actual &&
134
134
{
135
- echo "* master "
135
+ echo "* main "
136
136
} >expect &&
137
137
test_cmp expect actual
138
138
139
139
'
140
140
141
- test_expect_success ' master : branch --no-merged' '
141
+ test_expect_success ' main : branch --no-merged' '
142
142
143
143
git branch --no-merged >actual &&
144
144
{
@@ -150,22 +150,22 @@ test_expect_success 'master: branch --no-merged' '
150
150
151
151
test_expect_success ' branch --no-merged with pattern implies --list' '
152
152
153
- git branch --no-merged=master master >actual &&
153
+ git branch --no-merged=main main >actual &&
154
154
test_must_be_empty actual
155
155
156
156
'
157
157
158
158
test_expect_success ' implicit --list conflicts with modification options' '
159
159
160
- test_must_fail git branch --contains=master -d &&
161
- test_must_fail git branch --contains=master -m foo &&
162
- test_must_fail git branch --no-contains=master -d &&
163
- test_must_fail git branch --no-contains=master -m foo
160
+ test_must_fail git branch --contains=main -d &&
161
+ test_must_fail git branch --contains=main -m foo &&
162
+ test_must_fail git branch --no-contains=main -d &&
163
+ test_must_fail git branch --no-contains=main -m foo
164
164
165
165
'
166
166
167
167
test_expect_success ' Assert that --contains only works on commits, not trees & blobs' '
168
- test_must_fail git branch --contains master ^{tree} &&
168
+ test_must_fail git branch --contains main ^{tree} &&
169
169
blob=$(git hash-object -w --stdin <<-\EOF
170
170
Some blob
171
171
EOF
@@ -175,11 +175,11 @@ test_expect_success 'Assert that --contains only works on commits, not trees & b
175
175
'
176
176
177
177
test_expect_success ' multiple branch --contains' '
178
- git checkout -b side2 master &&
178
+ git checkout -b side2 main &&
179
179
>feature &&
180
180
git add feature &&
181
181
git commit -m "add feature" &&
182
- git checkout -b next master &&
182
+ git checkout -b next main &&
183
183
git merge side &&
184
184
git branch --contains side --contains side2 >actual &&
185
185
cat >expect <<-\EOF &&
@@ -191,9 +191,9 @@ test_expect_success 'multiple branch --contains' '
191
191
'
192
192
193
193
test_expect_success ' multiple branch --merged' '
194
- git branch --merged next --merged master >actual &&
194
+ git branch --merged next --merged main >actual &&
195
195
cat >expect <<-\EOF &&
196
- master
196
+ main
197
197
* next
198
198
side
199
199
EOF
@@ -203,21 +203,21 @@ test_expect_success 'multiple branch --merged' '
203
203
test_expect_success ' multiple branch --no-contains' '
204
204
git branch --no-contains side --no-contains side2 >actual &&
205
205
cat >expect <<-\EOF &&
206
- master
206
+ main
207
207
EOF
208
208
test_cmp expect actual
209
209
'
210
210
211
211
test_expect_success ' multiple branch --no-merged' '
212
- git branch --no-merged next --no-merged master >actual &&
212
+ git branch --no-merged next --no-merged main >actual &&
213
213
cat >expect <<-\EOF &&
214
214
side2
215
215
EOF
216
216
test_cmp expect actual
217
217
'
218
218
219
219
test_expect_success ' branch --contains combined with --no-contains' '
220
- git checkout -b seen master &&
220
+ git checkout -b seen main &&
221
221
git merge side &&
222
222
git merge side2 &&
223
223
git branch --contains side --no-contains side2 >actual &&
@@ -242,17 +242,17 @@ test_expect_success 'branch --merged combined with --no-merged' '
242
242
# that the latter walk does not mess up our flag to see if it was
243
243
# merged).
244
244
#
245
- # Here "topic" tracks "master " with one extra commit, and "zzz" points to the
246
- # same tip as master The name "zzz" must come alphabetically after "topic"
245
+ # Here "topic" tracks "main " with one extra commit, and "zzz" points to the
246
+ # same tip as main The name "zzz" must come alphabetically after "topic"
247
247
# as we process them in that order.
248
248
test_expect_success PREPARE_FOR_MAIN_BRANCH ' branch --merged with --verbose' '
249
- git branch --track topic master &&
249
+ git branch --track topic main &&
250
250
git branch zzz topic &&
251
251
git checkout topic &&
252
252
test_commit foo &&
253
253
git branch --merged topic >actual &&
254
254
cat >expect <<-\EOF &&
255
- master
255
+ main
256
256
* topic
257
257
zzz
258
258
EOF
0 commit comments