subtree: t7900: use test-lib.sh's test_count
Use test-lib.sh's `test_count`, instead instead of having t7900-subtree.sh do its own book-keeping with `subtree_test_count` that has to be explicitly incremented by calling `next_test`. Signed-off-by: Luke Shumaker <lukeshu@datawire.io> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Luke Shumaker committed
Apr 27, 2021 at 15:17 UTC
f2bb7fef7a8d9a88cb440ad362863e510f5f2369
1 file changed
+300
-336
contrib/subtree/t/t7900-subtree.sh
+300
-336
@@ -86,90 +86,79 @@ last_commit_message()
86
git log --pretty=format:%s -1
87
}
88
89
-subtree_test_count=0
90
-next_test() {
91
- subtree_test_count=$(($subtree_test_count+1))
92
-}
93
-
89
#
90
# Tests for 'git subtree add'
91
#
92
98
-next_test
93
test_expect_success 'no merge from non-existent subtree' '
100
- subtree_test_create_repo "$subtree_test_count" &&
101
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
102
- test_create_commit "$subtree_test_count" main1 &&
103
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
94
+ subtree_test_create_repo "$test_count" &&
95
+ subtree_test_create_repo "$test_count/sub proj" &&
96
+ test_create_commit "$test_count" main1 &&
97
+ test_create_commit "$test_count/sub proj" sub1 &&
98
(
105
- cd "$subtree_test_count" &&
99
+ cd "$test_count" &&
100
git fetch ./"sub proj" HEAD &&
101
test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
102
)
103
'
104
111
-next_test
105
test_expect_success 'no pull from non-existent subtree' '
113
- subtree_test_create_repo "$subtree_test_count" &&
114
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
115
- test_create_commit "$subtree_test_count" main1 &&
116
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
106
+ subtree_test_create_repo "$test_count" &&
107
+ subtree_test_create_repo "$test_count/sub proj" &&
108
+ test_create_commit "$test_count" main1 &&
109
+ test_create_commit "$test_count/sub proj" sub1 &&
110
(
118
- cd "$subtree_test_count" &&
111
+ cd "$test_count" &&
112
git fetch ./"sub proj" HEAD &&
113
test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" HEAD
114
)'
115
123
-next_test
116
test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
125
- subtree_test_create_repo "$subtree_test_count" &&
126
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
127
- test_create_commit "$subtree_test_count" main1 &&
128
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
117
+ subtree_test_create_repo "$test_count" &&
118
+ subtree_test_create_repo "$test_count/sub proj" &&
119
+ test_create_commit "$test_count" main1 &&
120
+ test_create_commit "$test_count/sub proj" sub1 &&
121
(
130
- cd "$subtree_test_count" &&
122
+ cd "$test_count" &&
123
git fetch ./"sub proj" HEAD &&
124
git subtree add --prefix="sub dir" FETCH_HEAD &&
125
check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' from commit '\''$(git rev-parse FETCH_HEAD)'\''"
126
)
127
'
128
137
-next_test
129
test_expect_success 'add subproj as subtree into sub dir/ with --prefix and --message' '
139
- subtree_test_create_repo "$subtree_test_count" &&
140
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
141
- test_create_commit "$subtree_test_count" main1 &&
142
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
130
+ subtree_test_create_repo "$test_count" &&
131
+ subtree_test_create_repo "$test_count/sub proj" &&
132
+ test_create_commit "$test_count" main1 &&
133
+ test_create_commit "$test_count/sub proj" sub1 &&
134
(
144
- cd "$subtree_test_count" &&
135
+ cd "$test_count" &&
136
git fetch ./"sub proj" HEAD &&
137
git subtree add --prefix="sub dir" --message="Added subproject" FETCH_HEAD &&
138
check_equal "$(last_commit_message)" "Added subproject"
139
)
140
'
141
151
-next_test
142
test_expect_success 'add subproj as subtree into sub dir/ with --prefix as -P and --message as -m' '
153
- subtree_test_create_repo "$subtree_test_count" &&
154
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
155
- test_create_commit "$subtree_test_count" main1 &&
156
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
143
+ subtree_test_create_repo "$test_count" &&
144
+ subtree_test_create_repo "$test_count/sub proj" &&
145
+ test_create_commit "$test_count" main1 &&
146
+ test_create_commit "$test_count/sub proj" sub1 &&
147
(
158
- cd "$subtree_test_count" &&
148
+ cd "$test_count" &&
149
git fetch ./"sub proj" HEAD &&
150
git subtree add -P "sub dir" -m "Added subproject" FETCH_HEAD &&
151
check_equal "$(last_commit_message)" "Added subproject"
152
)
153
'
154
165
-next_test
155
test_expect_success 'add subproj as subtree into sub dir/ with --squash and --prefix and --message' '
167
- subtree_test_create_repo "$subtree_test_count" &&
168
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
169
- test_create_commit "$subtree_test_count" main1 &&
170
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
156
+ subtree_test_create_repo "$test_count" &&
157
+ subtree_test_create_repo "$test_count/sub proj" &&
158
+ test_create_commit "$test_count" main1 &&
159
+ test_create_commit "$test_count/sub proj" sub1 &&
160
(
172
- cd "$subtree_test_count" &&
161
+ cd "$test_count" &&
162
git fetch ./"sub proj" HEAD &&
163
git subtree add --prefix="sub dir" --message="Added subproject with squash" --squash FETCH_HEAD &&
164
check_equal "$(last_commit_message)" "Added subproject with squash"
@@ -180,74 +169,70 @@ test_expect_success 'add subproj as subtree into sub dir/ with --squash and --pr
169
# Tests for 'git subtree merge'
170
#
171
183
-next_test
172
test_expect_success 'merge new subproj history into sub dir/ with --prefix' '
185
- subtree_test_create_repo "$subtree_test_count" &&
186
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
187
- test_create_commit "$subtree_test_count" main1 &&
188
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
173
+ subtree_test_create_repo "$test_count" &&
174
+ subtree_test_create_repo "$test_count/sub proj" &&
175
+ test_create_commit "$test_count" main1 &&
176
+ test_create_commit "$test_count/sub proj" sub1 &&
177
(
190
- cd "$subtree_test_count" &&
178
+ cd "$test_count" &&
179
git fetch ./"sub proj" HEAD &&
180
git subtree add --prefix="sub dir" FETCH_HEAD
181
) &&
194
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
182
+ test_create_commit "$test_count/sub proj" sub2 &&
183
(
196
- cd "$subtree_test_count" &&
184
+ cd "$test_count" &&
185
git fetch ./"sub proj" HEAD &&
186
git subtree merge --prefix="sub dir" FETCH_HEAD &&
187
check_equal "$(last_commit_message)" "Merge commit '\''$(git rev-parse FETCH_HEAD)'\''"
188
)
189
'
190
203
-next_test
191
test_expect_success 'merge new subproj history into sub dir/ with --prefix and --message' '
205
- subtree_test_create_repo "$subtree_test_count" &&
206
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
207
- test_create_commit "$subtree_test_count" main1 &&
208
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
192
+ subtree_test_create_repo "$test_count" &&
193
+ subtree_test_create_repo "$test_count/sub proj" &&
194
+ test_create_commit "$test_count" main1 &&
195
+ test_create_commit "$test_count/sub proj" sub1 &&
196
(
210
- cd "$subtree_test_count" &&
197
+ cd "$test_count" &&
198
git fetch ./"sub proj" HEAD &&
199
git subtree add --prefix="sub dir" FETCH_HEAD
200
) &&
214
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
201
+ test_create_commit "$test_count/sub proj" sub2 &&
202
(
216
- cd "$subtree_test_count" &&
203
+ cd "$test_count" &&
204
git fetch ./"sub proj" HEAD &&
205
git subtree merge --prefix="sub dir" --message="Merged changes from subproject" FETCH_HEAD &&
206
check_equal "$(last_commit_message)" "Merged changes from subproject"
207
)
208
'
209
223
-next_test
210
test_expect_success 'merge new subproj history into sub dir/ with --squash and --prefix and --message' '
225
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
226
- subtree_test_create_repo "$subtree_test_count" &&
227
- test_create_commit "$subtree_test_count" main1 &&
228
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
211
+ subtree_test_create_repo "$test_count/sub proj" &&
212
+ subtree_test_create_repo "$test_count" &&
213
+ test_create_commit "$test_count" main1 &&
214
+ test_create_commit "$test_count/sub proj" sub1 &&
215
(
230
- cd "$subtree_test_count" &&
216
+ cd "$test_count" &&
217
git fetch ./"sub proj" HEAD &&
218
git subtree add --prefix="sub dir" FETCH_HEAD
219
) &&
234
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
220
+ test_create_commit "$test_count/sub proj" sub2 &&
221
(
236
- cd "$subtree_test_count" &&
222
+ cd "$test_count" &&
223
git fetch ./"sub proj" HEAD &&
224
git subtree merge --prefix="sub dir" --message="Merged changes from subproject using squash" --squash FETCH_HEAD &&
225
check_equal "$(last_commit_message)" "Merged changes from subproject using squash"
226
)
227
'
228
243
-next_test
229
test_expect_success 'merge the added subproj again, should do nothing' '
245
- subtree_test_create_repo "$subtree_test_count" &&
246
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
247
- test_create_commit "$subtree_test_count" main1 &&
248
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
230
+ subtree_test_create_repo "$test_count" &&
231
+ subtree_test_create_repo "$test_count/sub proj" &&
232
+ test_create_commit "$test_count" main1 &&
233
+ test_create_commit "$test_count/sub proj" sub1 &&
234
(
250
- cd "$subtree_test_count" &&
235
+ cd "$test_count" &&
236
git fetch ./"sub proj" HEAD &&
237
git subtree add --prefix="sub dir" FETCH_HEAD &&
238
# this shouldn not actually do anything, since FETCH_HEAD
@@ -257,7 +242,6 @@ test_expect_success 'merge the added subproj again, should do nothing' '
242
)
243
'
244
260
-next_test
245
test_expect_success 'merge new subproj history into subdir/ with a slash appended to the argument of --prefix' '
246
test_create_repo "$test_count" &&
247
test_create_repo "$test_count/subproj" &&
@@ -281,14 +265,13 @@ test_expect_success 'merge new subproj history into subdir/ with a slash appende
265
# Tests for 'git subtree split'
266
#
267
284
-next_test
268
test_expect_success 'split requires option --prefix' '
286
- subtree_test_create_repo "$subtree_test_count" &&
287
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
288
- test_create_commit "$subtree_test_count" main1 &&
289
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
269
+ subtree_test_create_repo "$test_count" &&
270
+ subtree_test_create_repo "$test_count/sub proj" &&
271
+ test_create_commit "$test_count" main1 &&
272
+ test_create_commit "$test_count/sub proj" sub1 &&
273
(
291
- cd "$subtree_test_count" &&
274
+ cd "$test_count" &&
275
git fetch ./"sub proj" HEAD &&
276
git subtree add --prefix="sub dir" FETCH_HEAD &&
277
echo "You must provide the --prefix option." > expected &&
@@ -301,14 +284,13 @@ test_expect_success 'split requires option --prefix' '
284
)
285
'
286
304
-next_test
287
test_expect_success 'split requires path given by option --prefix must exist' '
306
- subtree_test_create_repo "$subtree_test_count" &&
307
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
308
- test_create_commit "$subtree_test_count" main1 &&
309
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
288
+ subtree_test_create_repo "$test_count" &&
289
+ subtree_test_create_repo "$test_count/sub proj" &&
290
+ test_create_commit "$test_count" main1 &&
291
+ test_create_commit "$test_count/sub proj" sub1 &&
292
(
311
- cd "$subtree_test_count" &&
293
+ cd "$test_count" &&
294
git fetch ./"sub proj" HEAD &&
295
git subtree add --prefix="sub dir" FETCH_HEAD &&
296
echo "'\''non-existent-directory'\'' does not exist; use '\''git subtree add'\''" > expected &&
@@ -321,23 +303,22 @@ test_expect_success 'split requires path given by option --prefix must exist' '
303
)
304
'
305
324
-next_test
306
test_expect_success 'split sub dir/ with --rejoin' '
326
- subtree_test_create_repo "$subtree_test_count" &&
327
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
328
- test_create_commit "$subtree_test_count" main1 &&
329
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
307
+ subtree_test_create_repo "$test_count" &&
308
+ subtree_test_create_repo "$test_count/sub proj" &&
309
+ test_create_commit "$test_count" main1 &&
310
+ test_create_commit "$test_count/sub proj" sub1 &&
311
(
331
- cd "$subtree_test_count" &&
312
+ cd "$test_count" &&
313
git fetch ./"sub proj" HEAD &&
314
git subtree add --prefix="sub dir" FETCH_HEAD
315
) &&
335
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
336
- test_create_commit "$subtree_test_count" main2 &&
337
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
338
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
316
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
317
+ test_create_commit "$test_count" main2 &&
318
+ test_create_commit "$test_count/sub proj" sub2 &&
319
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
320
(
340
- cd "$subtree_test_count" &&
321
+ cd "$test_count" &&
322
git fetch ./"sub proj" HEAD &&
323
git subtree merge --prefix="sub dir" FETCH_HEAD &&
324
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
@@ -346,12 +327,11 @@ test_expect_success 'split sub dir/ with --rejoin' '
327
)
328
'
329
349
-next_test
330
test_expect_success 'split sub dir/ with --rejoin from scratch' '
351
- subtree_test_create_repo "$subtree_test_count" &&
352
- test_create_commit "$subtree_test_count" main1 &&
331
+ subtree_test_create_repo "$test_count" &&
332
+ test_create_commit "$test_count" main1 &&
333
(
354
- cd "$subtree_test_count" &&
334
+ cd "$test_count" &&
335
mkdir "sub dir" &&
336
echo file >"sub dir"/file &&
337
git add "sub dir/file" &&
@@ -362,23 +342,22 @@ test_expect_success 'split sub dir/ with --rejoin from scratch' '
342
)
343
'
344
365
-next_test
345
test_expect_success 'split sub dir/ with --rejoin and --message' '
367
- subtree_test_create_repo "$subtree_test_count" &&
368
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
369
- test_create_commit "$subtree_test_count" main1 &&
370
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
346
+ subtree_test_create_repo "$test_count" &&
347
+ subtree_test_create_repo "$test_count/sub proj" &&
348
+ test_create_commit "$test_count" main1 &&
349
+ test_create_commit "$test_count/sub proj" sub1 &&
350
(
372
- cd "$subtree_test_count" &&
351
+ cd "$test_count" &&
352
git fetch ./"sub proj" HEAD &&
353
git subtree add --prefix="sub dir" FETCH_HEAD
354
) &&
376
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
377
- test_create_commit "$subtree_test_count" main2 &&
378
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
379
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
355
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
356
+ test_create_commit "$test_count" main2 &&
357
+ test_create_commit "$test_count/sub proj" sub2 &&
358
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
359
(
381
- cd "$subtree_test_count" &&
360
+ cd "$test_count" &&
361
git fetch ./"sub proj" HEAD &&
362
git subtree merge --prefix="sub dir" FETCH_HEAD &&
363
git subtree split --prefix="sub dir" --message="Split & rejoin" --annotate="*" --rejoin &&
@@ -386,23 +365,22 @@ test_expect_success 'split sub dir/ with --rejoin and --message' '
365
)
366
'
367
389
-next_test
368
test_expect_success 'split "sub dir"/ with --branch' '
391
- subtree_test_create_repo "$subtree_test_count" &&
392
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
393
- test_create_commit "$subtree_test_count" main1 &&
394
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
369
+ subtree_test_create_repo "$test_count" &&
370
+ subtree_test_create_repo "$test_count/sub proj" &&
371
+ test_create_commit "$test_count" main1 &&
372
+ test_create_commit "$test_count/sub proj" sub1 &&
373
(
396
- cd "$subtree_test_count" &&
374
+ cd "$test_count" &&
375
git fetch ./"sub proj" HEAD &&
376
git subtree add --prefix="sub dir" FETCH_HEAD
377
) &&
400
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
401
- test_create_commit "$subtree_test_count" main2 &&
402
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
403
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
378
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
379
+ test_create_commit "$test_count" main2 &&
380
+ test_create_commit "$test_count/sub proj" sub2 &&
381
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
382
(
405
- cd "$subtree_test_count" &&
383
+ cd "$test_count" &&
384
git fetch ./"sub proj" HEAD &&
385
git subtree merge --prefix="sub dir" FETCH_HEAD &&
386
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
@@ -411,23 +389,22 @@ test_expect_success 'split "sub dir"/ with --branch' '
389
)
390
'
391
414
-next_test
392
test_expect_success 'check hash of split' '
416
- subtree_test_create_repo "$subtree_test_count" &&
417
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
418
- test_create_commit "$subtree_test_count" main1 &&
419
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
393
+ subtree_test_create_repo "$test_count" &&
394
+ subtree_test_create_repo "$test_count/sub proj" &&
395
+ test_create_commit "$test_count" main1 &&
396
+ test_create_commit "$test_count/sub proj" sub1 &&
397
(
421
- cd "$subtree_test_count" &&
398
+ cd "$test_count" &&
399
git fetch ./"sub proj" HEAD &&
400
git subtree add --prefix="sub dir" FETCH_HEAD
401
) &&
425
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
426
- test_create_commit "$subtree_test_count" main2 &&
427
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
428
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
402
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
403
+ test_create_commit "$test_count" main2 &&
404
+ test_create_commit "$test_count/sub proj" sub2 &&
405
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
406
(
430
- cd "$subtree_test_count" &&
407
+ cd "$test_count" &&
408
git fetch ./"sub proj" HEAD &&
409
git subtree merge --prefix="sub dir" FETCH_HEAD &&
410
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
@@ -443,24 +420,23 @@ test_expect_success 'check hash of split' '
420
)
421
'
422
446
-next_test
423
test_expect_success 'split "sub dir"/ with --branch for an existing branch' '
448
- subtree_test_create_repo "$subtree_test_count" &&
449
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
450
- test_create_commit "$subtree_test_count" main1 &&
451
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
424
+ subtree_test_create_repo "$test_count" &&
425
+ subtree_test_create_repo "$test_count/sub proj" &&
426
+ test_create_commit "$test_count" main1 &&
427
+ test_create_commit "$test_count/sub proj" sub1 &&
428
(
453
- cd "$subtree_test_count" &&
429
+ cd "$test_count" &&
430
git fetch ./"sub proj" HEAD &&
431
git branch subproj-br FETCH_HEAD &&
432
git subtree add --prefix="sub dir" FETCH_HEAD
433
) &&
458
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
459
- test_create_commit "$subtree_test_count" main2 &&
460
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
461
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
434
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
435
+ test_create_commit "$test_count" main2 &&
436
+ test_create_commit "$test_count/sub proj" sub2 &&
437
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
438
(
463
- cd "$subtree_test_count" &&
439
+ cd "$test_count" &&
440
git fetch ./"sub proj" HEAD &&
441
git subtree merge --prefix="sub dir" FETCH_HEAD &&
442
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
@@ -469,24 +445,23 @@ test_expect_success 'split "sub dir"/ with --branch for an existing branch' '
445
)
446
'
447
472
-next_test
448
test_expect_success 'split "sub dir"/ with --branch for an incompatible branch' '
474
- subtree_test_create_repo "$subtree_test_count" &&
475
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
476
- test_create_commit "$subtree_test_count" main1 &&
477
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
449
+ subtree_test_create_repo "$test_count" &&
450
+ subtree_test_create_repo "$test_count/sub proj" &&
451
+ test_create_commit "$test_count" main1 &&
452
+ test_create_commit "$test_count/sub proj" sub1 &&
453
(
479
- cd "$subtree_test_count" &&
454
+ cd "$test_count" &&
455
git branch init HEAD &&
456
git fetch ./"sub proj" HEAD &&
457
git subtree add --prefix="sub dir" FETCH_HEAD
458
) &&
484
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
485
- test_create_commit "$subtree_test_count" main2 &&
486
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
487
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
459
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
460
+ test_create_commit "$test_count" main2 &&
461
+ test_create_commit "$test_count/sub proj" sub2 &&
462
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
463
(
489
- cd "$subtree_test_count" &&
464
+ cd "$test_count" &&
465
git fetch ./"sub proj" HEAD &&
466
git subtree merge --prefix="sub dir" FETCH_HEAD &&
467
test_must_fail git subtree split --prefix="sub dir" --branch init
@@ -497,46 +472,45 @@ test_expect_success 'split "sub dir"/ with --branch for an incompatible branch'
472
# Validity checking
473
#
474
500
-next_test
475
test_expect_success 'make sure exactly the right set of files ends up in the subproj' '
502
- subtree_test_create_repo "$subtree_test_count" &&
503
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
504
- test_create_commit "$subtree_test_count" main1 &&
505
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
476
+ subtree_test_create_repo "$test_count" &&
477
+ subtree_test_create_repo "$test_count/sub proj" &&
478
+ test_create_commit "$test_count" main1 &&
479
+ test_create_commit "$test_count/sub proj" sub1 &&
480
(
507
- cd "$subtree_test_count" &&
481
+ cd "$test_count" &&
482
git fetch ./"sub proj" HEAD &&
483
git subtree add --prefix="sub dir" FETCH_HEAD
484
) &&
511
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
512
- test_create_commit "$subtree_test_count" main2 &&
513
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
514
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
485
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
486
+ test_create_commit "$test_count" main2 &&
487
+ test_create_commit "$test_count/sub proj" sub2 &&
488
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
489
(
516
- cd "$subtree_test_count" &&
490
+ cd "$test_count" &&
491
git fetch ./"sub proj" HEAD &&
492
git subtree merge --prefix="sub dir" FETCH_HEAD &&
493
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
494
) &&
521
- test_create_commit "$subtree_test_count/sub proj" sub3 &&
522
- test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
495
+ test_create_commit "$test_count/sub proj" sub3 &&
496
+ test_create_commit "$test_count" "sub dir"/main-sub3 &&
497
(
524
- cd "$subtree_test_count/sub proj" &&
498
+ cd "$test_count/sub proj" &&
499
git fetch .. subproj-br &&
500
git merge FETCH_HEAD
501
) &&
528
- test_create_commit "$subtree_test_count/sub proj" sub4 &&
502
+ test_create_commit "$test_count/sub proj" sub4 &&
503
(
530
- cd "$subtree_test_count" &&
504
+ cd "$test_count" &&
505
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
506
) &&
533
- test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
507
+ test_create_commit "$test_count" "sub dir"/main-sub4 &&
508
(
535
- cd "$subtree_test_count" &&
509
+ cd "$test_count" &&
510
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
511
) &&
512
(
539
- cd "$subtree_test_count/sub proj" &&
513
+ cd "$test_count/sub proj" &&
514
git fetch .. subproj-br &&
515
git merge FETCH_HEAD &&
516
@@ -547,46 +521,45 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub
521
)
522
'
523
550
-next_test
524
test_expect_success 'make sure the subproj *only* contains commits that affect the "sub dir"' '
552
- subtree_test_create_repo "$subtree_test_count" &&
553
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
554
- test_create_commit "$subtree_test_count" main1 &&
555
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
525
+ subtree_test_create_repo "$test_count" &&
526
+ subtree_test_create_repo "$test_count/sub proj" &&
527
+ test_create_commit "$test_count" main1 &&
528
+ test_create_commit "$test_count/sub proj" sub1 &&
529
(
557
- cd "$subtree_test_count" &&
530
+ cd "$test_count" &&
531
git fetch ./"sub proj" HEAD &&
532
git subtree add --prefix="sub dir" FETCH_HEAD
533
) &&
561
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
562
- test_create_commit "$subtree_test_count" main2 &&
563
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
564
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
534
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
535
+ test_create_commit "$test_count" main2 &&
536
+ test_create_commit "$test_count/sub proj" sub2 &&
537
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
538
(
566
- cd "$subtree_test_count" &&
539
+ cd "$test_count" &&
540
git fetch ./"sub proj" HEAD &&
541
git subtree merge --prefix="sub dir" FETCH_HEAD &&
542
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
543
) &&
571
- test_create_commit "$subtree_test_count/sub proj" sub3 &&
572
- test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
544
+ test_create_commit "$test_count/sub proj" sub3 &&
545
+ test_create_commit "$test_count" "sub dir"/main-sub3 &&
546
(
574
- cd "$subtree_test_count/sub proj" &&
547
+ cd "$test_count/sub proj" &&
548
git fetch .. subproj-br &&
549
git merge FETCH_HEAD
550
) &&
578
- test_create_commit "$subtree_test_count/sub proj" sub4 &&
551
+ test_create_commit "$test_count/sub proj" sub4 &&
552
(
580
- cd "$subtree_test_count" &&
553
+ cd "$test_count" &&
554
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
555
) &&
583
- test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
556
+ test_create_commit "$test_count" "sub dir"/main-sub4 &&
557
(
585
- cd "$subtree_test_count" &&
558
+ cd "$test_count" &&
559
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
560
) &&
561
(
589
- cd "$subtree_test_count/sub proj" &&
562
+ cd "$test_count/sub proj" &&
563
git fetch .. subproj-br &&
564
git merge FETCH_HEAD &&
565
@@ -598,51 +571,50 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t
571
)
572
'
573
601
-next_test
574
test_expect_success 'make sure exactly the right set of files ends up in the mainline' '
603
- subtree_test_create_repo "$subtree_test_count" &&
604
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
605
- test_create_commit "$subtree_test_count" main1 &&
606
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
575
+ subtree_test_create_repo "$test_count" &&
576
+ subtree_test_create_repo "$test_count/sub proj" &&
577
+ test_create_commit "$test_count" main1 &&
578
+ test_create_commit "$test_count/sub proj" sub1 &&
579
(
608
- cd "$subtree_test_count" &&
580
+ cd "$test_count" &&
581
git fetch ./"sub proj" HEAD &&
582
git subtree add --prefix="sub dir" FETCH_HEAD
583
) &&
612
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
613
- test_create_commit "$subtree_test_count" main2 &&
614
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
615
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
584
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
585
+ test_create_commit "$test_count" main2 &&
586
+ test_create_commit "$test_count/sub proj" sub2 &&
587
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
588
(
617
- cd "$subtree_test_count" &&
589
+ cd "$test_count" &&
590
git fetch ./"sub proj" HEAD &&
591
git subtree merge --prefix="sub dir" FETCH_HEAD &&
592
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
593
) &&
622
- test_create_commit "$subtree_test_count/sub proj" sub3 &&
623
- test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
594
+ test_create_commit "$test_count/sub proj" sub3 &&
595
+ test_create_commit "$test_count" "sub dir"/main-sub3 &&
596
(
625
- cd "$subtree_test_count/sub proj" &&
597
+ cd "$test_count/sub proj" &&
598
git fetch .. subproj-br &&
599
git merge FETCH_HEAD
600
) &&
629
- test_create_commit "$subtree_test_count/sub proj" sub4 &&
601
+ test_create_commit "$test_count/sub proj" sub4 &&
602
(
631
- cd "$subtree_test_count" &&
603
+ cd "$test_count" &&
604
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
605
) &&
634
- test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
606
+ test_create_commit "$test_count" "sub dir"/main-sub4 &&
607
(
636
- cd "$subtree_test_count" &&
608
+ cd "$test_count" &&
609
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
610
) &&
611
(
640
- cd "$subtree_test_count/sub proj" &&
612
+ cd "$test_count/sub proj" &&
613
git fetch .. subproj-br &&
614
git merge FETCH_HEAD
615
) &&
616
(
645
- cd "$subtree_test_count" &&
617
+ cd "$test_count" &&
618
git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
619
620
test_write_lines main1 main2 >chkm &&
@@ -657,52 +629,51 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai
629
)
630
'
631
660
-next_test
632
test_expect_success 'make sure each filename changed exactly once in the entire history' '
662
- subtree_test_create_repo "$subtree_test_count" &&
663
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
664
- test_create_commit "$subtree_test_count" main1 &&
665
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
633
+ subtree_test_create_repo "$test_count" &&
634
+ subtree_test_create_repo "$test_count/sub proj" &&
635
+ test_create_commit "$test_count" main1 &&
636
+ test_create_commit "$test_count/sub proj" sub1 &&
637
(
667
- cd "$subtree_test_count" &&
638
+ cd "$test_count" &&
639
git config log.date relative &&
640
git fetch ./"sub proj" HEAD &&
641
git subtree add --prefix="sub dir" FETCH_HEAD
642
) &&
672
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
673
- test_create_commit "$subtree_test_count" main2 &&
674
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
675
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
643
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
644
+ test_create_commit "$test_count" main2 &&
645
+ test_create_commit "$test_count/sub proj" sub2 &&
646
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
647
(
677
- cd "$subtree_test_count" &&
648
+ cd "$test_count" &&
649
git fetch ./"sub proj" HEAD &&
650
git subtree merge --prefix="sub dir" FETCH_HEAD &&
651
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
652
) &&
682
- test_create_commit "$subtree_test_count/sub proj" sub3 &&
683
- test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
653
+ test_create_commit "$test_count/sub proj" sub3 &&
654
+ test_create_commit "$test_count" "sub dir"/main-sub3 &&
655
(
685
- cd "$subtree_test_count/sub proj" &&
656
+ cd "$test_count/sub proj" &&
657
git fetch .. subproj-br &&
658
git merge FETCH_HEAD
659
) &&
689
- test_create_commit "$subtree_test_count/sub proj" sub4 &&
660
+ test_create_commit "$test_count/sub proj" sub4 &&
661
(
691
- cd "$subtree_test_count" &&
662
+ cd "$test_count" &&
663
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
664
) &&
694
- test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
665
+ test_create_commit "$test_count" "sub dir"/main-sub4 &&
666
(
696
- cd "$subtree_test_count" &&
667
+ cd "$test_count" &&
668
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
669
) &&
670
(
700
- cd "$subtree_test_count/sub proj" &&
671
+ cd "$test_count/sub proj" &&
672
git fetch .. subproj-br &&
673
git merge FETCH_HEAD
674
) &&
675
(
705
- cd "$subtree_test_count" &&
676
+ cd "$test_count" &&
677
git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
678
679
test_write_lines main1 main2 >chkm &&
@@ -723,101 +694,99 @@ test_expect_success 'make sure each filename changed exactly once in the entire
694
)
695
'
696
726
-next_test
697
test_expect_success 'make sure the --rejoin commits never make it into subproj' '
728
- subtree_test_create_repo "$subtree_test_count" &&
729
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
730
- test_create_commit "$subtree_test_count" main1 &&
731
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
698
+ subtree_test_create_repo "$test_count" &&
699
+ subtree_test_create_repo "$test_count/sub proj" &&
700
+ test_create_commit "$test_count" main1 &&
701
+ test_create_commit "$test_count/sub proj" sub1 &&
702
(
733
- cd "$subtree_test_count" &&
703
+ cd "$test_count" &&
704
git fetch ./"sub proj" HEAD &&
705
git subtree add --prefix="sub dir" FETCH_HEAD
706
) &&
737
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
738
- test_create_commit "$subtree_test_count" main2 &&
739
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
740
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
707
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
708
+ test_create_commit "$test_count" main2 &&
709
+ test_create_commit "$test_count/sub proj" sub2 &&
710
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
711
(
742
- cd "$subtree_test_count" &&
712
+ cd "$test_count" &&
713
git fetch ./"sub proj" HEAD &&
714
git subtree merge --prefix="sub dir" FETCH_HEAD &&
715
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
716
) &&
747
- test_create_commit "$subtree_test_count/sub proj" sub3 &&
748
- test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
717
+ test_create_commit "$test_count/sub proj" sub3 &&
718
+ test_create_commit "$test_count" "sub dir"/main-sub3 &&
719
(
750
- cd "$subtree_test_count/sub proj" &&
720
+ cd "$test_count/sub proj" &&
721
git fetch .. subproj-br &&
722
git merge FETCH_HEAD
723
) &&
754
- test_create_commit "$subtree_test_count/sub proj" sub4 &&
724
+ test_create_commit "$test_count/sub proj" sub4 &&
725
(
756
- cd "$subtree_test_count" &&
726
+ cd "$test_count" &&
727
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
728
) &&
759
- test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
729
+ test_create_commit "$test_count" "sub dir"/main-sub4 &&
730
(
761
- cd "$subtree_test_count" &&
731
+ cd "$test_count" &&
732
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
733
) &&
734
(
765
- cd "$subtree_test_count/sub proj" &&
735
+ cd "$test_count/sub proj" &&
736
git fetch .. subproj-br &&
737
git merge FETCH_HEAD
738
) &&
739
(
770
- cd "$subtree_test_count" &&
740
+ cd "$test_count" &&
741
git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
742
check_equal "$(git log --pretty=format:"%s" HEAD^2 | grep -i split)" ""
743
)
744
'
745
776
-next_test
746
test_expect_success 'make sure no "git subtree" tagged commits make it into subproj' '
778
- subtree_test_create_repo "$subtree_test_count" &&
779
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
780
- test_create_commit "$subtree_test_count" main1 &&
781
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
747
+ subtree_test_create_repo "$test_count" &&
748
+ subtree_test_create_repo "$test_count/sub proj" &&
749
+ test_create_commit "$test_count" main1 &&
750
+ test_create_commit "$test_count/sub proj" sub1 &&
751
(
783
- cd "$subtree_test_count" &&
752
+ cd "$test_count" &&
753
git fetch ./"sub proj" HEAD &&
754
git subtree add --prefix="sub dir" FETCH_HEAD
755
) &&
787
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
788
- test_create_commit "$subtree_test_count" main2 &&
789
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
790
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
756
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
757
+ test_create_commit "$test_count" main2 &&
758
+ test_create_commit "$test_count/sub proj" sub2 &&
759
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
760
(
792
- cd "$subtree_test_count" &&
761
+ cd "$test_count" &&
762
git fetch ./"sub proj" HEAD &&
763
git subtree merge --prefix="sub dir" FETCH_HEAD &&
764
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
765
) &&
797
- test_create_commit "$subtree_test_count/sub proj" sub3 &&
798
- test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
766
+ test_create_commit "$test_count/sub proj" sub3 &&
767
+ test_create_commit "$test_count" "sub dir"/main-sub3 &&
768
(
800
- cd "$subtree_test_count/sub proj" &&
769
+ cd "$test_count/sub proj" &&
770
git fetch .. subproj-br &&
771
git merge FETCH_HEAD
772
) &&
804
- test_create_commit "$subtree_test_count/sub proj" sub4 &&
773
+ test_create_commit "$test_count/sub proj" sub4 &&
774
(
806
- cd "$subtree_test_count" &&
775
+ cd "$test_count" &&
776
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
777
) &&
809
- test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
778
+ test_create_commit "$test_count" "sub dir"/main-sub4 &&
779
(
811
- cd "$subtree_test_count" &&
780
+ cd "$test_count" &&
781
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
782
) &&
783
(
815
- cd "$subtree_test_count/sub proj" &&
784
+ cd "$test_count/sub proj" &&
785
git fetch .. subproj-br &&
786
git merge FETCH_HEAD
787
) &&
788
(
820
- cd "$subtree_test_count" &&
789
+ cd "$test_count" &&
790
git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
791
792
# They are meaningless to subproj since one side of the merge refers to the mainline
@@ -829,27 +798,26 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
798
# A new set of tests
799
#
800
832
-next_test
801
test_expect_success 'make sure "git subtree split" find the correct parent' '
834
- subtree_test_create_repo "$subtree_test_count" &&
835
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
836
- test_create_commit "$subtree_test_count" main1 &&
837
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
802
+ subtree_test_create_repo "$test_count" &&
803
+ subtree_test_create_repo "$test_count/sub proj" &&
804
+ test_create_commit "$test_count" main1 &&
805
+ test_create_commit "$test_count/sub proj" sub1 &&
806
(
839
- cd "$subtree_test_count" &&
807
+ cd "$test_count" &&
808
git fetch ./"sub proj" HEAD &&
809
git subtree add --prefix="sub dir" FETCH_HEAD
810
) &&
843
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
811
+ test_create_commit "$test_count/sub proj" sub2 &&
812
(
845
- cd "$subtree_test_count" &&
813
+ cd "$test_count" &&
814
git fetch ./"sub proj" HEAD &&
815
git branch subproj-ref FETCH_HEAD &&
816
git subtree merge --prefix="sub dir" FETCH_HEAD
817
) &&
850
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
818
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
819
(
852
- cd "$subtree_test_count" &&
820
+ cd "$test_count" &&
821
git subtree split --prefix="sub dir" --branch subproj-br &&
822
823
# at this point, the new commit parent should be subproj-ref, if it is
@@ -860,32 +828,31 @@ test_expect_success 'make sure "git subtree split" find the correct parent' '
828
)
829
'
830
863
-next_test
831
test_expect_success 'split a new subtree without --onto option' '
865
- subtree_test_create_repo "$subtree_test_count" &&
866
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
867
- test_create_commit "$subtree_test_count" main1 &&
868
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
832
+ subtree_test_create_repo "$test_count" &&
833
+ subtree_test_create_repo "$test_count/sub proj" &&
834
+ test_create_commit "$test_count" main1 &&
835
+ test_create_commit "$test_count/sub proj" sub1 &&
836
(
870
- cd "$subtree_test_count" &&
837
+ cd "$test_count" &&
838
git fetch ./"sub proj" HEAD &&
839
git subtree add --prefix="sub dir" FETCH_HEAD
840
) &&
874
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
841
+ test_create_commit "$test_count/sub proj" sub2 &&
842
(
876
- cd "$subtree_test_count" &&
843
+ cd "$test_count" &&
844
git fetch ./"sub proj" HEAD &&
845
git subtree merge --prefix="sub dir" FETCH_HEAD
846
) &&
880
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
847
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
848
(
882
- cd "$subtree_test_count" &&
849
+ cd "$test_count" &&
850
git subtree split --prefix="sub dir" --branch subproj-br
851
) &&
885
- mkdir "$subtree_test_count"/"sub dir2" &&
886
- test_create_commit "$subtree_test_count" "sub dir2"/main-sub2 &&
852
+ mkdir "$test_count"/"sub dir2" &&
853
+ test_create_commit "$test_count" "sub dir2"/main-sub2 &&
854
(
888
- cd "$subtree_test_count" &&
855
+ cd "$test_count" &&
856
857
# also test that we still can split out an entirely new subtree
858
# if the parent of the first commit in the tree is not empty,
@@ -895,33 +862,32 @@ test_expect_success 'split a new subtree without --onto option' '
862
)
863
'
864
898
-next_test
865
test_expect_success 'verify one file change per commit' '
900
- subtree_test_create_repo "$subtree_test_count" &&
901
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
902
- test_create_commit "$subtree_test_count" main1 &&
903
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
866
+ subtree_test_create_repo "$test_count" &&
867
+ subtree_test_create_repo "$test_count/sub proj" &&
868
+ test_create_commit "$test_count" main1 &&
869
+ test_create_commit "$test_count/sub proj" sub1 &&
870
(
905
- cd "$subtree_test_count" &&
871
+ cd "$test_count" &&
872
git fetch ./"sub proj" HEAD &&
873
git branch sub1 FETCH_HEAD &&
874
git subtree add --prefix="sub dir" sub1
875
) &&
910
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
876
+ test_create_commit "$test_count/sub proj" sub2 &&
877
(
912
- cd "$subtree_test_count" &&
878
+ cd "$test_count" &&
879
git fetch ./"sub proj" HEAD &&
880
git subtree merge --prefix="sub dir" FETCH_HEAD
881
) &&
916
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
882
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
883
(
918
- cd "$subtree_test_count" &&
884
+ cd "$test_count" &&
885
git subtree split --prefix="sub dir" --branch subproj-br
886
) &&
921
- mkdir "$subtree_test_count"/"sub dir2" &&
922
- test_create_commit "$subtree_test_count" "sub dir2"/main-sub2 &&
887
+ mkdir "$test_count"/"sub dir2" &&
888
+ test_create_commit "$test_count" "sub dir2"/main-sub2 &&
889
(
924
- cd "$subtree_test_count" &&
890
+ cd "$test_count" &&
891
git subtree split --prefix="sub dir2" --branch subproj2-br &&
892
893
x= &&
@@ -939,31 +905,30 @@ test_expect_success 'verify one file change per commit' '
905
)
906
'
907
942
-next_test
908
test_expect_success 'push split to subproj' '
944
- subtree_test_create_repo "$subtree_test_count" &&
945
- subtree_test_create_repo "$subtree_test_count/sub proj" &&
946
- test_create_commit "$subtree_test_count" main1 &&
947
- test_create_commit "$subtree_test_count/sub proj" sub1 &&
909
+ subtree_test_create_repo "$test_count" &&
910
+ subtree_test_create_repo "$test_count/sub proj" &&
911
+ test_create_commit "$test_count" main1 &&
912
+ test_create_commit "$test_count/sub proj" sub1 &&
913
(
949
- cd "$subtree_test_count" &&
914
+ cd "$test_count" &&
915
git fetch ./"sub proj" HEAD &&
916
git subtree add --prefix="sub dir" FETCH_HEAD
917
) &&
953
- test_create_commit "$subtree_test_count" "sub dir"/main-sub1 &&
954
- test_create_commit "$subtree_test_count" main2 &&
955
- test_create_commit "$subtree_test_count/sub proj" sub2 &&
956
- test_create_commit "$subtree_test_count" "sub dir"/main-sub2 &&
918
+ test_create_commit "$test_count" "sub dir"/main-sub1 &&
919
+ test_create_commit "$test_count" main2 &&
920
+ test_create_commit "$test_count/sub proj" sub2 &&
921
+ test_create_commit "$test_count" "sub dir"/main-sub2 &&
922
(
958
- cd $subtree_test_count/"sub proj" &&
923
+ cd $test_count/"sub proj" &&
924
git branch sub-branch-1 &&
925
cd .. &&
926
git fetch ./"sub proj" HEAD &&
927
git subtree merge --prefix="sub dir" FETCH_HEAD
928
) &&
964
- test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
929
+ test_create_commit "$test_count" "sub dir"/main-sub3 &&
930
(
966
- cd "$subtree_test_count" &&
931
+ cd "$test_count" &&
932
git subtree push ./"sub proj" --prefix "sub dir" sub-branch-1 &&
933
cd ./"sub proj" &&
934
git checkout sub-branch-1 &&
@@ -991,38 +956,37 @@ test_expect_success 'push split to subproj' '
956
# set of commits.
957
#
958
994
-next_test
959
test_expect_success 'subtree descendant check' '
996
- subtree_test_create_repo "$subtree_test_count" &&
997
- defaultBranch=$(sed "s,ref: refs/heads/,," "$subtree_test_count/.git/HEAD") &&
998
- test_create_commit "$subtree_test_count" folder_subtree/a &&
960
+ subtree_test_create_repo "$test_count" &&
961
+ defaultBranch=$(sed "s,ref: refs/heads/,," "$test_count/.git/HEAD") &&
962
+ test_create_commit "$test_count" folder_subtree/a &&
963
(
1000
- cd "$subtree_test_count" &&
964
+ cd "$test_count" &&
965
git branch branch
966
) &&
1003
- test_create_commit "$subtree_test_count" folder_subtree/0 &&
1004
- test_create_commit "$subtree_test_count" folder_subtree/b &&
1005
- cherry=$(cd "$subtree_test_count"; git rev-parse HEAD) &&
967
+ test_create_commit "$test_count" folder_subtree/0 &&
968
+ test_create_commit "$test_count" folder_subtree/b &&
969
+ cherry=$(cd "$test_count"; git rev-parse HEAD) &&
970
(
1007
- cd "$subtree_test_count" &&
971
+ cd "$test_count" &&
972
git checkout branch
973
) &&
1010
- test_create_commit "$subtree_test_count" commit_on_branch &&
974
+ test_create_commit "$test_count" commit_on_branch &&
975
(
1012
- cd "$subtree_test_count" &&
976
+ cd "$test_count" &&
977
git cherry-pick $cherry &&
978
git checkout $defaultBranch &&
979
git merge -m "merge should be kept on subtree" branch &&
980
git branch no_subtree_work_branch
981
) &&
1018
- test_create_commit "$subtree_test_count" folder_subtree/d &&
982
+ test_create_commit "$test_count" folder_subtree/d &&
983
(
1020
- cd "$subtree_test_count" &&
984
+ cd "$test_count" &&
985
git checkout no_subtree_work_branch
986
) &&
1023
- test_create_commit "$subtree_test_count" not_a_subtree_change &&
987
+ test_create_commit "$test_count" not_a_subtree_change &&
988
(
1025
- cd "$subtree_test_count" &&
989
+ cd "$test_count" &&
990
git checkout $defaultBranch &&
991
git merge -m "merge should be skipped on subtree" no_subtree_work_branch &&
992