@@ -111,21 +111,21 @@ test_expect_success 'Remove nonexistent file with --ignore-unmatch' '
111
111
'
112
112
113
113
test_expect_success ' "rm" command printed' '
114
- echo frotz > test-file &&
114
+ echo frotz >test-file &&
115
115
git add test-file &&
116
116
git commit -m "add file for rm test" &&
117
- git rm test-file > rm-output &&
117
+ git rm test-file >rm-output &&
118
118
test $(grep "^rm " rm-output | wc -l) = 1 &&
119
119
rm -f test-file rm-output &&
120
120
git commit -m "remove file from rm test"
121
121
'
122
122
123
123
test_expect_success ' "rm" command suppressed with --quiet' '
124
- echo frotz > test-file &&
124
+ echo frotz >test-file &&
125
125
git add test-file &&
126
126
git commit -m "add file for rm --quiet test" &&
127
- git rm --quiet test-file > rm-output &&
128
- test $(wc -l < rm-output) = 0 &&
127
+ git rm --quiet test-file >rm-output &&
128
+ test_must_be_empty rm-output &&
129
129
rm -f test-file rm-output &&
130
130
git commit -m "remove file from rm --quiet test"
131
131
'
@@ -221,7 +221,7 @@ test_expect_success 'Call "rm" from outside the work tree' '
221
221
mkdir repo &&
222
222
(cd repo &&
223
223
git init &&
224
- echo something > somefile &&
224
+ echo something >somefile &&
225
225
git add somefile &&
226
226
git commit -m "add a file" &&
227
227
(cd .. &&
@@ -287,7 +287,7 @@ test_expect_success 'rm removes empty submodules from work tree' '
287
287
git commit -m "add submodule" &&
288
288
git rm submod &&
289
289
test ! -e submod &&
290
- git status -s -uno --ignore-submodules=none > actual &&
290
+ git status -s -uno --ignore-submodules=none >actual &&
291
291
test_cmp expect actual &&
292
292
test_must_fail git config -f .gitmodules submodule.sub.url &&
293
293
test_must_fail git config -f .gitmodules submodule.sub.path
@@ -298,7 +298,7 @@ test_expect_success 'rm removes removed submodule from index and .gitmodules' '
298
298
git submodule update &&
299
299
rm -rf submod &&
300
300
git rm submod &&
301
- git status -s -uno --ignore-submodules=none > actual &&
301
+ git status -s -uno --ignore-submodules=none >actual &&
302
302
test_cmp expect actual &&
303
303
test_must_fail git config -f .gitmodules submodule.sub.url &&
304
304
test_must_fail git config -f .gitmodules submodule.sub.path
@@ -309,7 +309,7 @@ test_expect_success 'rm removes work tree of unmodified submodules' '
309
309
git submodule update &&
310
310
git rm submod &&
311
311
test ! -d submod &&
312
- git status -s -uno --ignore-submodules=none > actual &&
312
+ git status -s -uno --ignore-submodules=none >actual &&
313
313
test_cmp expect actual &&
314
314
test_must_fail git config -f .gitmodules submodule.sub.url &&
315
315
test_must_fail git config -f .gitmodules submodule.sub.path
@@ -320,7 +320,7 @@ test_expect_success 'rm removes a submodule with a trailing /' '
320
320
git submodule update &&
321
321
git rm submod/ &&
322
322
test ! -d submod &&
323
- git status -s -uno --ignore-submodules=none > actual &&
323
+ git status -s -uno --ignore-submodules=none >actual &&
324
324
test_cmp expect actual
325
325
'
326
326
@@ -335,17 +335,15 @@ test_expect_success 'rm succeeds when given a directory with a trailing /' '
335
335
test_expect_success ' rm of a populated submodule with different HEAD fails unless forced' '
336
336
git reset --hard &&
337
337
git submodule update &&
338
- (cd submod &&
339
- git checkout HEAD^
340
- ) &&
338
+ git -C submod checkout HEAD^ &&
341
339
test_must_fail git rm submod &&
342
340
test -d submod &&
343
341
test -f submod/.git &&
344
- git status -s -uno --ignore-submodules=none > actual &&
342
+ git status -s -uno --ignore-submodules=none >actual &&
345
343
test_cmp expect.modified actual &&
346
344
git rm -f submod &&
347
345
test ! -d submod &&
348
- git status -s -uno --ignore-submodules=none > actual &&
346
+ git status -s -uno --ignore-submodules=none >actual &&
349
347
test_cmp expect actual &&
350
348
test_must_fail git config -f .gitmodules submodule.sub.url &&
351
349
test_must_fail git config -f .gitmodules submodule.sub.path
@@ -418,34 +416,30 @@ test_expect_success 'rm issues a warning when section is not found in .gitmodule
418
416
test_expect_success ' rm of a populated submodule with modifications fails unless forced' '
419
417
git reset --hard &&
420
418
git submodule update &&
421
- (cd submod &&
422
- echo X >empty
423
- ) &&
419
+ echo X >submod/empty &&
424
420
test_must_fail git rm submod &&
425
421
test -d submod &&
426
422
test -f submod/.git &&
427
- git status -s -uno --ignore-submodules=none > actual &&
423
+ git status -s -uno --ignore-submodules=none >actual &&
428
424
test_cmp expect.modified actual &&
429
425
git rm -f submod &&
430
426
test ! -d submod &&
431
- git status -s -uno --ignore-submodules=none > actual &&
427
+ git status -s -uno --ignore-submodules=none >actual &&
432
428
test_cmp expect actual
433
429
'
434
430
435
431
test_expect_success ' rm of a populated submodule with untracked files fails unless forced' '
436
432
git reset --hard &&
437
433
git submodule update &&
438
- (cd submod &&
439
- echo X >untracked
440
- ) &&
434
+ echo X >submod/untracked &&
441
435
test_must_fail git rm submod &&
442
436
test -d submod &&
443
437
test -f submod/.git &&
444
- git status -s -uno --ignore-submodules=none > actual &&
438
+ git status -s -uno --ignore-submodules=none >actual &&
445
439
test_cmp expect.modified actual &&
446
440
git rm -f submod &&
447
441
test ! -d submod &&
448
- git status -s -uno --ignore-submodules=none > actual &&
442
+ git status -s -uno --ignore-submodules=none >actual &&
449
443
test_cmp expect actual
450
444
'
451
445
@@ -461,16 +455,12 @@ test_expect_success 'setup submodule conflict' '
461
455
git add nitfol &&
462
456
git commit -m "added nitfol 2" &&
463
457
git checkout -b conflict1 master &&
464
- (cd submod &&
465
- git fetch &&
466
- git checkout branch1
467
- ) &&
458
+ git -C submod fetch &&
459
+ git -C submod checkout branch1 &&
468
460
git add submod &&
469
461
git commit -m "submod 1" &&
470
462
git checkout -b conflict2 master &&
471
- (cd submod &&
472
- git checkout branch2
473
- ) &&
463
+ git -C submod checkout branch2 &&
474
464
git add submod &&
475
465
git commit -m "submod 2"
476
466
'
@@ -486,26 +476,24 @@ test_expect_success 'rm removes work tree of unmodified conflicted submodule' '
486
476
test_must_fail git merge conflict2 &&
487
477
git rm submod &&
488
478
test ! -d submod &&
489
- git status -s -uno --ignore-submodules=none > actual &&
479
+ git status -s -uno --ignore-submodules=none >actual &&
490
480
test_cmp expect actual
491
481
'
492
482
493
483
test_expect_success ' rm of a conflicted populated submodule with different HEAD fails unless forced' '
494
484
git checkout conflict1 &&
495
485
git reset --hard &&
496
486
git submodule update &&
497
- (cd submod &&
498
- git checkout HEAD^
499
- ) &&
487
+ git -C submod checkout HEAD^ &&
500
488
test_must_fail git merge conflict2 &&
501
489
test_must_fail git rm submod &&
502
490
test -d submod &&
503
491
test -f submod/.git &&
504
- git status -s -uno --ignore-submodules=none > actual &&
492
+ git status -s -uno --ignore-submodules=none >actual &&
505
493
test_cmp expect.conflict actual &&
506
494
git rm -f submod &&
507
495
test ! -d submod &&
508
- git status -s -uno --ignore-submodules=none > actual &&
496
+ git status -s -uno --ignore-submodules=none >actual &&
509
497
test_cmp expect actual &&
510
498
test_must_fail git config -f .gitmodules submodule.sub.url &&
511
499
test_must_fail git config -f .gitmodules submodule.sub.path
@@ -515,18 +503,16 @@ test_expect_success 'rm of a conflicted populated submodule with modifications f
515
503
git checkout conflict1 &&
516
504
git reset --hard &&
517
505
git submodule update &&
518
- (cd submod &&
519
- echo X >empty
520
- ) &&
506
+ echo X >submod/empty &&
521
507
test_must_fail git merge conflict2 &&
522
508
test_must_fail git rm submod &&
523
509
test -d submod &&
524
510
test -f submod/.git &&
525
- git status -s -uno --ignore-submodules=none > actual &&
511
+ git status -s -uno --ignore-submodules=none >actual &&
526
512
test_cmp expect.conflict actual &&
527
513
git rm -f submod &&
528
514
test ! -d submod &&
529
- git status -s -uno --ignore-submodules=none > actual &&
515
+ git status -s -uno --ignore-submodules=none >actual &&
530
516
test_cmp expect actual &&
531
517
test_must_fail git config -f .gitmodules submodule.sub.url &&
532
518
test_must_fail git config -f .gitmodules submodule.sub.path
@@ -536,18 +522,16 @@ test_expect_success 'rm of a conflicted populated submodule with untracked files
536
522
git checkout conflict1 &&
537
523
git reset --hard &&
538
524
git submodule update &&
539
- (cd submod &&
540
- echo X >untracked
541
- ) &&
525
+ echo X >submod/untracked &&
542
526
test_must_fail git merge conflict2 &&
543
527
test_must_fail git rm submod &&
544
528
test -d submod &&
545
529
test -f submod/.git &&
546
- git status -s -uno --ignore-submodules=none > actual &&
530
+ git status -s -uno --ignore-submodules=none >actual &&
547
531
test_cmp expect.conflict actual &&
548
532
git rm -f submod &&
549
533
test ! -d submod &&
550
- git status -s -uno --ignore-submodules=none > actual &&
534
+ git status -s -uno --ignore-submodules=none >actual &&
551
535
test_cmp expect actual
552
536
'
553
537
@@ -564,12 +548,12 @@ test_expect_success 'rm of a conflicted populated submodule with a .git director
564
548
test_must_fail git rm submod &&
565
549
test -d submod &&
566
550
test -d submod/.git &&
567
- git status -s -uno --ignore-submodules=none > actual &&
551
+ git status -s -uno --ignore-submodules=none >actual &&
568
552
test_cmp expect.conflict actual &&
569
553
test_must_fail git rm -f submod &&
570
554
test -d submod &&
571
555
test -d submod/.git &&
572
- git status -s -uno --ignore-submodules=none > actual &&
556
+ git status -s -uno --ignore-submodules=none >actual &&
573
557
test_cmp expect.conflict actual &&
574
558
git merge --abort &&
575
559
rm -rf submod
@@ -581,7 +565,7 @@ test_expect_success 'rm of a conflicted unpopulated submodule succeeds' '
581
565
test_must_fail git merge conflict2 &&
582
566
git rm submod &&
583
567
test ! -d submod &&
584
- git status -s -uno --ignore-submodules=none > actual &&
568
+ git status -s -uno --ignore-submodules=none >actual &&
585
569
test_cmp expect actual
586
570
'
587
571
@@ -597,12 +581,12 @@ test_expect_success 'rm of a populated submodule with a .git directory fails eve
597
581
test_must_fail git rm submod &&
598
582
test -d submod &&
599
583
test -d submod/.git &&
600
- git status -s -uno --ignore-submodules=none > actual &&
584
+ git status -s -uno --ignore-submodules=none >actual &&
601
585
! test -s actual &&
602
586
test_must_fail git rm -f submod &&
603
587
test -d submod &&
604
588
test -d submod/.git &&
605
- git status -s -uno --ignore-submodules=none > actual &&
589
+ git status -s -uno --ignore-submodules=none >actual &&
606
590
! test -s actual &&
607
591
rm -rf submod
608
592
'
@@ -629,58 +613,52 @@ test_expect_success 'setup subsubmodule' '
629
613
test_expect_success ' rm recursively removes work tree of unmodified submodules' '
630
614
git rm submod &&
631
615
test ! -d submod &&
632
- git status -s -uno --ignore-submodules=none > actual &&
616
+ git status -s -uno --ignore-submodules=none >actual &&
633
617
test_cmp expect actual
634
618
'
635
619
636
620
test_expect_success ' rm of a populated nested submodule with different nested HEAD fails unless forced' '
637
621
git reset --hard &&
638
622
git submodule update --recursive &&
639
- (cd submod/subsubmod &&
640
- git checkout HEAD^
641
- ) &&
623
+ git -C submod/subsubmod checkout HEAD^ &&
642
624
test_must_fail git rm submod &&
643
625
test -d submod &&
644
626
test -f submod/.git &&
645
- git status -s -uno --ignore-submodules=none > actual &&
627
+ git status -s -uno --ignore-submodules=none >actual &&
646
628
test_cmp expect.modified actual &&
647
629
git rm -f submod &&
648
630
test ! -d submod &&
649
- git status -s -uno --ignore-submodules=none > actual &&
631
+ git status -s -uno --ignore-submodules=none >actual &&
650
632
test_cmp expect actual
651
633
'
652
634
653
635
test_expect_success ' rm of a populated nested submodule with nested modifications fails unless forced' '
654
636
git reset --hard &&
655
637
git submodule update --recursive &&
656
- (cd submod/subsubmod &&
657
- echo X >empty
658
- ) &&
638
+ echo X >submod/subsubmod/empty &&
659
639
test_must_fail git rm submod &&
660
640
test -d submod &&
661
641
test -f submod/.git &&
662
- git status -s -uno --ignore-submodules=none > actual &&
642
+ git status -s -uno --ignore-submodules=none >actual &&
663
643
test_cmp expect.modified actual &&
664
644
git rm -f submod &&
665
645
test ! -d submod &&
666
- git status -s -uno --ignore-submodules=none > actual &&
646
+ git status -s -uno --ignore-submodules=none >actual &&
667
647
test_cmp expect actual
668
648
'
669
649
670
650
test_expect_success ' rm of a populated nested submodule with nested untracked files fails unless forced' '
671
651
git reset --hard &&
672
652
git submodule update --recursive &&
673
- (cd submod/subsubmod &&
674
- echo X >untracked
675
- ) &&
653
+ echo X >submod/subsubmod/untracked &&
676
654
test_must_fail git rm submod &&
677
655
test -d submod &&
678
656
test -f submod/.git &&
679
- git status -s -uno --ignore-submodules=none > actual &&
657
+ git status -s -uno --ignore-submodules=none >actual &&
680
658
test_cmp expect.modified actual &&
681
659
git rm -f submod &&
682
660
test ! -d submod &&
683
- git status -s -uno --ignore-submodules=none > actual &&
661
+ git status -s -uno --ignore-submodules=none >actual &&
684
662
test_cmp expect actual
685
663
'
686
664
@@ -695,12 +673,12 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc
695
673
test_must_fail git rm submod &&
696
674
test -d submod &&
697
675
test -d submod/subsubmod/.git &&
698
- git status -s -uno --ignore-submodules=none > actual &&
676
+ git status -s -uno --ignore-submodules=none >actual &&
699
677
! test -s actual &&
700
678
test_must_fail git rm -f submod &&
701
679
test -d submod &&
702
680
test -d submod/subsubmod/.git &&
703
- git status -s -uno --ignore-submodules=none > actual &&
681
+ git status -s -uno --ignore-submodules=none >actual &&
704
682
! test -s actual &&
705
683
rm -rf submod
706
684
'
@@ -709,14 +687,14 @@ test_expect_success 'checking out a commit after submodule removal needs manual
709
687
git commit -m "submodule removal" submod &&
710
688
git checkout HEAD^ &&
711
689
git submodule update &&
712
- git checkout -q HEAD^ 2>actual &&
690
+ git checkout -q HEAD^ &&
713
691
git checkout -q master 2>actual &&
714
692
test_i18ngrep "^warning: unable to rmdir submod:" actual &&
715
693
git status -s submod >actual &&
716
694
echo "?? submod/" >expected &&
717
695
test_cmp expected actual &&
718
696
rm -rf submod &&
719
- git status -s -uno --ignore-submodules=none > actual &&
697
+ git status -s -uno --ignore-submodules=none >actual &&
720
698
! test -s actual
721
699
'
722
700
0 commit comments