18
D=`pwd`
19
20
mk_empty () {
21
- rm -fr testrepo &&
22
- mkdir testrepo &&
21
+ repo_name="$1"
22
+ rm -fr "$repo_name" &&
23
+ mkdir "$repo_name" &&
24
(
24
- cd testrepo &&
25
+ cd "$repo_name" &&
26
git init &&
27
git config receive.denyCurrentBranch warn &&
28
mv .git/hooks .git/hooks-disabled
30
}
31
32
mk_test () {
32
- mk_empty &&
33
+ repo_name="$1"
34
+ shift
35
+
36
+ mk_empty "$repo_name" &&
37
(
38
for ref in "$@"
39
do
36
- git push testrepo $the_first_commit:refs/$ref ||
40
+ git push "$repo_name" $the_first_commit:refs/$ref ||
41
exit
42
done &&
39
- cd testrepo &&
43
+ cd "$repo_name" &&
44
for ref in "$@"
45
do
46
echo "$the_first_commit" >expect &&
53
}
54
55
mk_test_with_hooks() {
56
+ repo_name=$1
57
mk_test "$@" &&
58
(
54
- cd testrepo &&
59
+ cd "$repo_name" &&
60
mkdir .git/hooks &&
61
cd .git/hooks &&
62
88
}
89
90
mk_child() {
86
- rm -rf "$1" &&
87
- git clone testrepo "$1"
91
+ rm -rf "$2" &&
92
+ git clone "$1" "$2"
93
}
94
95
check_push_result () {
96
+ repo_name="$1"
97
+ shift
98
+
99
(
92
- cd testrepo &&
100
+ cd "$repo_name" &&
101
echo "$1" >expect &&
102
shift &&
103
for ref in "$@"
127
'
128
129
test_expect_success 'fetch without wildcard' '
122
- mk_empty &&
130
+ mk_empty testrepo &&
131
(
132
cd testrepo &&
133
git fetch .. refs/heads/master:refs/remotes/origin/master &&
139
'
140
141
test_expect_success 'fetch with wildcard' '
134
- mk_empty &&
142
+ mk_empty testrepo &&
143
(
144
cd testrepo &&
145
git config remote.up.url .. &&
153
'
154
155
test_expect_success 'fetch with insteadOf' '
148
- mk_empty &&
156
+ mk_empty testrepo &&
157
(
158
TRASH=$(pwd)/ &&
159
cd testrepo &&
169
'
170
171
test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '
164
- mk_empty &&
172
+ mk_empty testrepo &&
173
(
174
TRASH=$(pwd)/ &&
175
cd testrepo &&
185
'
186
187
test_expect_success 'push without wildcard' '
180
- mk_empty &&
188
+ mk_empty testrepo &&
189
190
git push testrepo refs/heads/master:refs/remotes/origin/master &&
191
(
197
'
198
199
test_expect_success 'push with wildcard' '
192
- mk_empty &&
200
+ mk_empty testrepo &&
201
202
git push testrepo "refs/heads/*:refs/remotes/origin/*" &&
203
(
209
'
210
211
test_expect_success 'push with insteadOf' '
204
- mk_empty &&
212
+ mk_empty testrepo &&
213
TRASH="$(pwd)/" &&
214
test_config "url.$TRASH.insteadOf" trash/ &&
215
git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
222
'
223
224
test_expect_success 'push with pushInsteadOf' '
217
- mk_empty &&
225
+ mk_empty testrepo &&
226
TRASH="$(pwd)/" &&
227
test_config "url.$TRASH.pushInsteadOf" trash/ &&
228
git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
235
'
236
237
test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' '
230
- mk_empty &&
238
+ mk_empty testrepo &&
239
TRASH="$(pwd)/" &&
240
test_config "url.trash2/.pushInsteadOf" trash/ &&
241
test_config remote.r.url trash/wrong &&
251
252
test_expect_success 'push with matching heads' '
253
246
- mk_test heads/master &&
254
+ mk_test testrepo heads/master &&
255
git push testrepo &&
248
- check_push_result $the_commit heads/master
256
+ check_push_result testrepo $the_commit heads/master
257
258
'
259
260
test_expect_success 'push with matching heads on the command line' '
261
254
- mk_test heads/master &&
262
+ mk_test testrepo heads/master &&
263
git push testrepo : &&
256
- check_push_result $the_commit heads/master
264
+ check_push_result testrepo $the_commit heads/master
265
266
'
267
268
test_expect_success 'failed (non-fast-forward) push with matching heads' '
269
262
- mk_test heads/master &&
270
+ mk_test testrepo heads/master &&
271
git push testrepo : &&
272
git commit --amend -massaged &&
273
test_must_fail git push testrepo &&
266
- check_push_result $the_commit heads/master &&
274
+ check_push_result testrepo $the_commit heads/master &&
275
git reset --hard $the_commit
276
277
'
278
279
test_expect_success 'push --force with matching heads' '
280
273
- mk_test heads/master &&
281
+ mk_test testrepo heads/master &&
282
git push testrepo : &&
283
git commit --amend -massaged &&
284
git push --force testrepo &&
277
- ! check_push_result $the_commit heads/master &&
285
+ ! check_push_result testrepo $the_commit heads/master &&
286
git reset --hard $the_commit
287
288
'
289
290
test_expect_success 'push with matching heads and forced update' '
291
284
- mk_test heads/master &&
292
+ mk_test testrepo heads/master &&
293
git push testrepo : &&
294
git commit --amend -massaged &&
295
git push testrepo +: &&
288
- ! check_push_result $the_commit heads/master &&
296
+ ! check_push_result testrepo $the_commit heads/master &&
297
git reset --hard $the_commit
298
299
'
300
301
test_expect_success 'push with no ambiguity (1)' '
302
295
- mk_test heads/master &&
303
+ mk_test testrepo heads/master &&
304
git push testrepo master:master &&
297
- check_push_result $the_commit heads/master
305
+ check_push_result testrepo $the_commit heads/master
306
307
'
308
309
test_expect_success 'push with no ambiguity (2)' '
310
303
- mk_test remotes/origin/master &&
311
+ mk_test testrepo remotes/origin/master &&
312
git push testrepo master:origin/master &&
305
- check_push_result $the_commit remotes/origin/master
313
+ check_push_result testrepo $the_commit remotes/origin/master
314
315
'
316
317
test_expect_success 'push with colon-less refspec, no ambiguity' '
318
311
- mk_test heads/master heads/t/master &&
319
+ mk_test testrepo heads/master heads/t/master &&
320
git branch -f t/master master &&
321
git push testrepo master &&
314
- check_push_result $the_commit heads/master &&
315
- check_push_result $the_first_commit heads/t/master
322
+ check_push_result testrepo $the_commit heads/master &&
323
+ check_push_result testrepo $the_first_commit heads/t/master
324
325
'
326
327
test_expect_success 'push with weak ambiguity (1)' '
328
321
- mk_test heads/master remotes/origin/master &&
329
+ mk_test testrepo heads/master remotes/origin/master &&
330
git push testrepo master:master &&
323
- check_push_result $the_commit heads/master &&
324
- check_push_result $the_first_commit remotes/origin/master
331
+ check_push_result testrepo $the_commit heads/master &&
332
+ check_push_result testrepo $the_first_commit remotes/origin/master
333
334
'
335
336
test_expect_success 'push with weak ambiguity (2)' '
337
330
- mk_test heads/master remotes/origin/master remotes/another/master &&
338
+ mk_test testrepo heads/master remotes/origin/master remotes/another/master &&
339
git push testrepo master:master &&
332
- check_push_result $the_commit heads/master &&
333
- check_push_result $the_first_commit remotes/origin/master remotes/another/master
340
+ check_push_result testrepo $the_commit heads/master &&
341
+ check_push_result testrepo $the_first_commit remotes/origin/master remotes/another/master
342
343
'
344
345
test_expect_success 'push with ambiguity' '
346
339
- mk_test heads/frotz tags/frotz &&
347
+ mk_test testrepo heads/frotz tags/frotz &&
348
test_must_fail git push testrepo master:frotz &&
341
- check_push_result $the_first_commit heads/frotz tags/frotz
349
+ check_push_result testrepo $the_first_commit heads/frotz tags/frotz
350
351
'
352
353
test_expect_success 'push with colon-less refspec (1)' '
354
347
- mk_test heads/frotz tags/frotz &&
355
+ mk_test testrepo heads/frotz tags/frotz &&
356
git branch -f frotz master &&
357
git push testrepo frotz &&
350
- check_push_result $the_commit heads/frotz &&
351
- check_push_result $the_first_commit tags/frotz
358
+ check_push_result testrepo $the_commit heads/frotz &&
359
+ check_push_result testrepo $the_first_commit tags/frotz
360
361
'
362
363
test_expect_success 'push with colon-less refspec (2)' '
364
357
- mk_test heads/frotz tags/frotz &&
365
+ mk_test testrepo heads/frotz tags/frotz &&
366
if git show-ref --verify -q refs/heads/frotz
367
then
368
git branch -D frotz
369
fi &&
370
git tag -f frotz &&
371
git push -f testrepo frotz &&
364
- check_push_result $the_commit tags/frotz &&
365
- check_push_result $the_first_commit heads/frotz
372
+ check_push_result testrepo $the_commit tags/frotz &&
373
+ check_push_result testrepo $the_first_commit heads/frotz
374
375
'
376
377
test_expect_success 'push with colon-less refspec (3)' '
378
371
- mk_test &&
379
+ mk_test testrepo &&
380
if git show-ref --verify -q refs/tags/frotz
381
then
382
git tag -d frotz
383
fi &&
384
git branch -f frotz master &&
385
git push testrepo frotz &&
378
- check_push_result $the_commit heads/frotz &&
386
+ check_push_result testrepo $the_commit heads/frotz &&
387
test 1 = $( cd testrepo && git show-ref | wc -l )
388
'
389
390
test_expect_success 'push with colon-less refspec (4)' '
391
384
- mk_test &&
392
+ mk_test testrepo &&
393
if git show-ref --verify -q refs/heads/frotz
394
then
395
git branch -D frotz
396
fi &&
397
git tag -f frotz &&
398
git push testrepo frotz &&
391
- check_push_result $the_commit tags/frotz &&
399
+ check_push_result testrepo $the_commit tags/frotz &&
400
test 1 = $( cd testrepo && git show-ref | wc -l )
401
402
'
403
404
test_expect_success 'push head with non-existent, incomplete dest' '
405
398
- mk_test &&
406
+ mk_test testrepo &&
407
git push testrepo master:branch &&
400
- check_push_result $the_commit heads/branch
408
+ check_push_result testrepo $the_commit heads/branch
409
410
'
411
412
test_expect_success 'push tag with non-existent, incomplete dest' '
413
406
- mk_test &&
414
+ mk_test testrepo &&
415
git tag -f v1.0 &&
416
git push testrepo v1.0:tag &&
409
- check_push_result $the_commit tags/tag
417
+ check_push_result testrepo $the_commit tags/tag
418
419
'
420
421
test_expect_success 'push sha1 with non-existent, incomplete dest' '
422
415
- mk_test &&
423
+ mk_test testrepo &&
424
test_must_fail git push testrepo `git rev-parse master`:foo
425
426
'
427
428
test_expect_success 'push ref expression with non-existent, incomplete dest' '
429
422
- mk_test &&
430
+ mk_test testrepo &&
431
test_must_fail git push testrepo master^:branch
432
433
'
434
435
test_expect_success 'push with HEAD' '
436
429
- mk_test heads/master &&
437
+ mk_test testrepo heads/master &&
438
git checkout master &&
439
git push testrepo HEAD &&
432
- check_push_result $the_commit heads/master
440
+ check_push_result testrepo $the_commit heads/master
441
442
'
443
444
test_expect_success 'push with HEAD nonexisting at remote' '
445
438
- mk_test heads/master &&
446
+ mk_test testrepo heads/master &&
447
git checkout -b local master &&
448
git push testrepo HEAD &&
441
- check_push_result $the_commit heads/local
449
+ check_push_result testrepo $the_commit heads/local
450
'
451
452
test_expect_success 'push with +HEAD' '
453
446
- mk_test heads/master &&
454
+ mk_test testrepo heads/master &&
455
git checkout master &&
456
git branch -D local &&
457
git checkout -b local &&
458
git push testrepo master local &&
451
- check_push_result $the_commit heads/master &&
452
- check_push_result $the_commit heads/local &&
459
+ check_push_result testrepo $the_commit heads/master &&
460
+ check_push_result testrepo $the_commit heads/local &&
461
462
# Without force rewinding should fail
463
git reset --hard HEAD^ &&
464
test_must_fail git push testrepo HEAD &&
457
- check_push_result $the_commit heads/local &&
465
+ check_push_result testrepo $the_commit heads/local &&
466
467
# With force rewinding should succeed
468
git push testrepo +HEAD &&
461
- check_push_result $the_first_commit heads/local
469
+ check_push_result testrepo $the_first_commit heads/local
470
471
'
472
473
test_expect_success 'push HEAD with non-existent, incomplete dest' '
474
467
- mk_test &&
475
+ mk_test testrepo &&
476
git checkout master &&
477
git push testrepo HEAD:branch &&
470
- check_push_result $the_commit heads/branch
478
+ check_push_result testrepo $the_commit heads/branch
479
480
'
481
482
test_expect_success 'push with config remote.*.push = HEAD' '
483
476
- mk_test heads/local &&
484
+ mk_test testrepo heads/local &&
485
git checkout master &&
486
git branch -f local $the_commit &&
487
(
493
test_config remote.there.push HEAD &&
494
test_config branch.master.remote there &&
495
git push &&
488
- check_push_result $the_commit heads/master &&
489
- check_push_result $the_first_commit heads/local
496
+ check_push_result testrepo $the_commit heads/master &&
497
+ check_push_result testrepo $the_first_commit heads/local
498
'
499
500
test_expect_success 'push with config remote.*.pushurl' '
501
494
- mk_test heads/master &&
502
+ mk_test testrepo heads/master &&
503
git checkout master &&
504
test_config remote.there.url test2repo &&
505
test_config remote.there.pushurl testrepo &&
506
git push there &&
499
- check_push_result $the_commit heads/master
507
+ check_push_result testrepo $the_commit heads/master
508
'
509
510
test_expect_success 'push with dry-run' '
511
504
- mk_test heads/master &&
512
+ mk_test testrepo heads/master &&
513
(
514
cd testrepo &&
515
old_commit=$(git show-ref -s --verify refs/heads/master)
516
) &&
517
git push --dry-run testrepo &&
510
- check_push_result $old_commit heads/master
518
+ check_push_result testrepo $old_commit heads/master
519
'
520
521
test_expect_success 'push updates local refs' '
522
515
- mk_test heads/master &&
516
- mk_child child &&
523
+ mk_test testrepo heads/master &&
524
+ mk_child testrepo child &&
525
(
526
cd child &&
527
git pull .. master &&
534
535
test_expect_success 'push updates up-to-date local refs' '
536
529
- mk_test heads/master &&
530
- mk_child child1 &&
531
- mk_child child2 &&
537
+ mk_test testrepo heads/master &&
538
+ mk_child testrepo child1 &&
539
+ mk_child testrepo child2 &&
540
(cd child1 && git pull .. master && git push) &&
541
(
542
cd child2 &&
550
551
test_expect_success 'push preserves up-to-date packed refs' '
552
545
- mk_test heads/master &&
546
- mk_child child &&
553
+ mk_test testrepo heads/master &&
554
+ mk_child testrepo child &&
555
(
556
cd child &&
557
git push &&
562
563
test_expect_success 'push does not update local refs on failure' '
564
557
- mk_test heads/master &&
558
- mk_child child &&
565
+ mk_test testrepo heads/master &&
566
+ mk_child testrepo child &&
567
mkdir testrepo/.git/hooks &&
568
echo "#!/no/frobnication/today" >testrepo/.git/hooks/pre-receive &&
569
chmod +x testrepo/.git/hooks/pre-receive &&
579
580
test_expect_success 'allow deleting an invalid remote ref' '
581
574
- mk_test heads/master &&
582
+ mk_test testrepo heads/master &&
583
rm -f testrepo/.git/objects/??/* &&
584
git push testrepo :refs/heads/master &&
585
(cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
587
'
588
589
test_expect_success 'pushing valid refs triggers post-receive and post-update hooks' '
582
- mk_test_with_hooks heads/master heads/next &&
590
+ mk_test_with_hooks testrepo heads/master heads/next &&
591
orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
592
newmaster=$(git show-ref -s --verify refs/heads/master) &&
593
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
623
'
624
625
test_expect_success 'deleting dangling ref triggers hooks with correct args' '
618
- mk_test_with_hooks heads/master &&
626
+ mk_test_with_hooks testrepo heads/master &&
627
rm -f testrepo/.git/objects/??/* &&
628
git push testrepo :refs/heads/master &&
629
(
652
'
653
654
test_expect_success 'deletion of a non-existent ref is not fed to post-receive and post-update hooks' '
647
- mk_test_with_hooks heads/master &&
655
+ mk_test_with_hooks testrepo heads/master &&
656
orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
657
newmaster=$(git show-ref -s --verify refs/heads/master) &&
658
git push testrepo master :refs/heads/nonexistent &&
684
'
685
686
test_expect_success 'deletion of a non-existent ref alone does trigger post-receive and post-update hooks' '
679
- mk_test_with_hooks heads/master &&
687
+ mk_test_with_hooks testrepo heads/master &&
688
git push testrepo :refs/heads/nonexistent &&
689
(
690
cd testrepo/.git &&
704
'
705
706
test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks with correct input' '
699
- mk_test_with_hooks heads/master heads/next heads/pu &&
707
+ mk_test_with_hooks testrepo heads/master heads/next heads/pu &&
708
orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
709
newmaster=$(git show-ref -s --verify refs/heads/master) &&
710
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
750
'
751
752
test_expect_success 'allow deleting a ref using --delete' '
745
- mk_test heads/master &&
753
+ mk_test testrepo heads/master &&
754
(cd testrepo && git config receive.denyDeleteCurrent warn) &&
755
git push testrepo --delete master &&
756
(cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
757
'
758
759
test_expect_success 'allow deleting a tag using --delete' '
752
- mk_test heads/master &&
760
+ mk_test testrepo heads/master &&
761
git tag -a -m dummy_message deltag heads/master &&
762
git push testrepo --tags &&
763
(cd testrepo && git rev-parse --verify -q refs/tags/deltag) &&
766
'
767
768
test_expect_success 'push --delete without args aborts' '
761
- mk_test heads/master &&
769
+ mk_test testrepo heads/master &&
770
test_must_fail git push testrepo --delete
771
'
772
773
test_expect_success 'push --delete refuses src:dest refspecs' '
766
- mk_test heads/master &&
774
+ mk_test testrepo heads/master &&
775
test_must_fail git push testrepo --delete master:foo
776
'
777
778
test_expect_success 'warn on push to HEAD of non-bare repository' '
771
- mk_test heads/master &&
779
+ mk_test testrepo heads/master &&
780
(
781
cd testrepo &&
782
git checkout master &&
787
'
788
789
test_expect_success 'deny push to HEAD of non-bare repository' '
782
- mk_test heads/master &&
790
+ mk_test testrepo heads/master &&
791
(
792
cd testrepo &&
793
git checkout master &&
797
'
798
799
test_expect_success 'allow push to HEAD of bare repository (bare)' '
792
- mk_test heads/master &&
800
+ mk_test testrepo heads/master &&
801
(
802
cd testrepo &&
803
git checkout master &&
809
'
810
811
test_expect_success 'allow push to HEAD of non-bare repository (config)' '
804
- mk_test heads/master &&
812
+ mk_test testrepo heads/master &&
813
(
814
cd testrepo &&
815
git checkout master &&
820
'
821
822
test_expect_success 'fetch with branches' '
815
- mk_empty &&
823
+ mk_empty testrepo &&
824
git branch second $the_first_commit &&
825
git checkout second &&
826
echo ".." > testrepo/.git/branches/branch1 &&
835
'
836
837
test_expect_success 'fetch with branches containing #' '
830
- mk_empty &&
838
+ mk_empty testrepo &&
839
echo "..#second" > testrepo/.git/branches/branch2 &&
840
(
841
cd testrepo &&
848
'
849
850
test_expect_success 'push with branches' '
843
- mk_empty &&
851
+ mk_empty testrepo &&
852
git checkout second &&
853
echo "testrepo" > .git/branches/branch1 &&
854
git push branch1 &&
861
'
862
863
test_expect_success 'push with branches containing #' '
856
- mk_empty &&
864
+ mk_empty testrepo &&
865
echo "testrepo#branch3" > .git/branches/branch2 &&
866
git push branch2 &&
867
(
874
'
875
876
test_expect_success 'push into aliased refs (consistent)' '
869
- mk_test heads/master &&
870
- mk_child child1 &&
871
- mk_child child2 &&
877
+ mk_test testrepo heads/master &&
878
+ mk_child testrepo child1 &&
879
+ mk_child testrepo child2 &&
880
(
881
cd child1 &&
882
git branch foo &&
896
'
897
898
test_expect_success 'push into aliased refs (inconsistent)' '
891
- mk_test heads/master &&
892
- mk_child child1 &&
893
- mk_child child2 &&
899
+ mk_test testrepo heads/master &&
900
+ mk_child testrepo child1 &&
901
+ mk_child testrepo child2 &&
902
(
903
cd child1 &&
904
git branch foo &&
923
'
924
925
test_expect_success 'push requires --force to update lightweight tag' '
918
- mk_test heads/master &&
919
- mk_child child1 &&
920
- mk_child child2 &&
926
+ mk_test testrepo heads/master &&
927
+ mk_child testrepo child1 &&
928
+ mk_child testrepo child2 &&
929
(
930
cd child1 &&
931
git tag Tag &&
944
'
945
946
test_expect_success 'push --porcelain' '
939
- mk_empty &&
947
+ mk_empty testrepo &&
948
echo >.git/foo "To testrepo" &&
949
echo >>.git/foo "* refs/heads/master:refs/remotes/origin/master [new branch]" &&
950
echo >>.git/foo "Done" &&
959
'
960
961
test_expect_success 'push --porcelain bad url' '
954
- mk_empty &&
962
+ mk_empty testrepo &&
963
test_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/master:refs/remotes/origin/master &&
964
test_must_fail grep -q Done .git/bar
965
'
966
967
test_expect_success 'push --porcelain rejected' '
960
- mk_empty &&
968
+ mk_empty testrepo &&
969
git push testrepo refs/heads/master:refs/remotes/origin/master &&
970
(cd testrepo &&
971
git reset --hard origin/master^
979
'
980
981
test_expect_success 'push --porcelain --dry-run rejected' '
974
- mk_empty &&
982
+ mk_empty testrepo &&
983
git push testrepo refs/heads/master:refs/remotes/origin/master &&
984
(cd testrepo &&
985
git reset --hard origin/master
994
'
995
996
test_expect_success 'push --prune' '
989
- mk_test heads/master heads/second heads/foo heads/bar &&
997
+ mk_test testrepo heads/master heads/second heads/foo heads/bar &&
998
git push --prune testrepo &&
991
- check_push_result $the_commit heads/master &&
992
- check_push_result $the_first_commit heads/second &&
993
- ! check_push_result $the_first_commit heads/foo heads/bar
999
+ check_push_result testrepo $the_commit heads/master &&
1000
+ check_push_result testrepo $the_first_commit heads/second &&
1001
+ ! check_push_result testrepo $the_first_commit heads/foo heads/bar
1002
'
1003
1004
test_expect_success 'push --prune refspec' '
997
- mk_test tmp/master tmp/second tmp/foo tmp/bar &&
1005
+ mk_test testrepo tmp/master tmp/second tmp/foo tmp/bar &&
1006
git push --prune testrepo "refs/heads/*:refs/tmp/*" &&
999
- check_push_result $the_commit tmp/master &&
1000
- check_push_result $the_first_commit tmp/second &&
1001
- ! check_push_result $the_first_commit tmp/foo tmp/bar
1007
+ check_push_result testrepo $the_commit tmp/master &&
1008
+ check_push_result testrepo $the_first_commit tmp/second &&
1009
+ ! check_push_result testrepo $the_first_commit tmp/foo tmp/bar
1010
'
1011
1012
for configsection in transfer receive
1013
do
1014
test_expect_success "push to update a ref hidden by $configsection.hiderefs" '
1007
- mk_test heads/master hidden/one hidden/two hidden/three &&
1015
+ mk_test testrepo heads/master hidden/one hidden/two hidden/three &&
1016
(
1017
cd testrepo &&
1018
git config $configsection.hiderefs refs/hidden
1020
1021
# push to unhidden ref succeeds normally
1022
git push testrepo master:refs/heads/master &&
1015
- check_push_result $the_commit heads/master &&
1023
+ check_push_result testrepo $the_commit heads/master &&
1024
1025
# push to update a hidden ref should fail
1026
test_must_fail git push testrepo master:refs/hidden/one &&
1019
- check_push_result $the_first_commit hidden/one &&
1027
+ check_push_result testrepo $the_first_commit hidden/one &&
1028
1029
# push to delete a hidden ref should fail
1030
test_must_fail git push testrepo :refs/hidden/two &&
1023
- check_push_result $the_first_commit hidden/two &&
1031
+ check_push_result testrepo $the_first_commit hidden/two &&
1032
1033
# idempotent push to update a hidden ref should fail
1034
test_must_fail git push testrepo $the_first_commit:refs/hidden/three &&
1027
- check_push_result $the_first_commit hidden/three
1035
+ check_push_result testrepo $the_first_commit hidden/three
1036
'
1037
done
1038
1039
test_expect_success 'fetch exact SHA1' '
1032
- mk_test heads/master hidden/one &&
1040
+ mk_test testrepo heads/master hidden/one &&
1041
git push testrepo master:refs/hidden/one &&
1042
(
1043
cd testrepo &&
1044
git config transfer.hiderefs refs/hidden
1045
) &&
1038
- check_push_result $the_commit hidden/one &&
1046
+ check_push_result testrepo $the_commit hidden/one &&
1047
1040
- mk_child child &&
1048
+ mk_child testrepo child &&
1049
(
1050
cd child &&
1051
1071
'
1072
1073
test_expect_success 'fetch follows tags by default' '
1066
- mk_test heads/master &&
1074
+ mk_test testrepo heads/master &&
1075
rm -fr src dst &&
1076
git init src &&
1077
(
1098
'
1099
1100
test_expect_success 'push does not follow tags by default' '
1093
- mk_test heads/master &&
1101
+ mk_test testrepo heads/master &&
1102
rm -fr src dst &&
1103
git init src &&
1104
git init --bare dst &&
1121
'
1122
1123
test_expect_success 'push --follow-tag only pushes relevant tags' '
1116
- mk_test heads/master &&
1124
+ mk_test testrepo heads/master &&
1125
rm -fr src dst &&
1126
git init src &&
1127
git init --bare dst &&