t3600: slightly modernize style

Remove the space between redirection and file name. Also remove unnecessary invocations of subshells, such as (cd submod && echo X >untracked ) && as there is no point of having the shell for functional purposes. In case of a single Git command use the `-C` option to let Git cd into the directory. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Dec 12, 2016 at 15:54 UTC 9e189f1a5ccfd09fb2c9d1fdf3ee9b59bb0b0231
1 file changed +51 -73
t/t3600-rm.sh
+51 -73
@@ -111,21 +111,21 @@ test_expect_success 'Remove nonexistent file with --ignore-unmatch' '
111 '
112
113 test_expect_success '"rm" command printed' '
114 - echo frotz > test-file &&
114 + echo frotz >test-file &&
115 git add test-file &&
116 git commit -m "add file for rm test" &&
117 - git rm test-file > rm-output &&
118 - test `grep "^rm " rm-output | wc -l` = 1 &&
117 + git rm test-file >rm-output &&
118 + test $(grep "^rm " rm-output | wc -l) = 1 &&
119 rm -f test-file rm-output &&
120 git commit -m "remove file from rm test"
121 '
122
123 test_expect_success '"rm" command suppressed with --quiet' '
124 - echo frotz > test-file &&
124 + echo frotz >test-file &&
125 git add test-file &&
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 rm -f test-file rm-output &&
130 git commit -m "remove file from rm --quiet test"
131 '
@@ -221,7 +221,7 @@ test_expect_success 'Call "rm" from outside the work tree' '
221 mkdir repo &&
222 (cd repo &&
223 git init &&
224 - echo something > somefile &&
224 + echo something >somefile &&
225 git add somefile &&
226 git commit -m "add a file" &&
227 (cd .. &&
@@ -287,7 +287,7 @@ test_expect_success 'rm removes empty submodules from work tree' '
287 git commit -m "add submodule" &&
288 git rm submod &&
289 test ! -e submod &&
290 - git status -s -uno --ignore-submodules=none > actual &&
290 + git status -s -uno --ignore-submodules=none >actual &&
291 test_cmp expect actual &&
292 test_must_fail git config -f .gitmodules submodule.sub.url &&
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 git submodule update &&
299 rm -rf submod &&
300 git rm submod &&
301 - git status -s -uno --ignore-submodules=none > actual &&
301 + git status -s -uno --ignore-submodules=none >actual &&
302 test_cmp expect actual &&
303 test_must_fail git config -f .gitmodules submodule.sub.url &&
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 git submodule update &&
310 git rm submod &&
311 test ! -d submod &&
312 - git status -s -uno --ignore-submodules=none > actual &&
312 + git status -s -uno --ignore-submodules=none >actual &&
313 test_cmp expect actual &&
314 test_must_fail git config -f .gitmodules submodule.sub.url &&
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 git submodule update &&
321 git rm submod/ &&
322 test ! -d submod &&
323 - git status -s -uno --ignore-submodules=none > actual &&
323 + git status -s -uno --ignore-submodules=none >actual &&
324 test_cmp expect actual
325 '
326
@@ -335,17 +335,15 @@ test_expect_success 'rm succeeds when given a directory with a trailing /' '
335 test_expect_success 'rm of a populated submodule with different HEAD fails unless forced' '
336 git reset --hard &&
337 git submodule update &&
338 - (cd submod &&
339 - git checkout HEAD^
340 - ) &&
338 + git -C submod checkout HEAD^ &&
339 test_must_fail git rm submod &&
340 test -d submod &&
341 test -f submod/.git &&
344 - git status -s -uno --ignore-submodules=none > actual &&
342 + git status -s -uno --ignore-submodules=none >actual &&
343 test_cmp expect.modified actual &&
344 git rm -f submod &&
345 test ! -d submod &&
348 - git status -s -uno --ignore-submodules=none > actual &&
346 + git status -s -uno --ignore-submodules=none >actual &&
347 test_cmp expect actual &&
348 test_must_fail git config -f .gitmodules submodule.sub.url &&
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
416 test_expect_success 'rm of a populated submodule with modifications fails unless forced' '
417 git reset --hard &&
418 git submodule update &&
421 - (cd submod &&
422 - echo X >empty
423 - ) &&
419 + echo X >submod/empty &&
420 test_must_fail git rm submod &&
421 test -d submod &&
422 test -f submod/.git &&
427 - git status -s -uno --ignore-submodules=none > actual &&
423 + git status -s -uno --ignore-submodules=none >actual &&
424 test_cmp expect.modified actual &&
425 git rm -f submod &&
426 test ! -d submod &&
431 - git status -s -uno --ignore-submodules=none > actual &&
427 + git status -s -uno --ignore-submodules=none >actual &&
428 test_cmp expect actual
429 '
430
431 test_expect_success 'rm of a populated submodule with untracked files fails unless forced' '
432 git reset --hard &&
433 git submodule update &&
438 - (cd submod &&
439 - echo X >untracked
440 - ) &&
434 + echo X >submod/untracked &&
435 test_must_fail git rm submod &&
436 test -d submod &&
437 test -f submod/.git &&
444 - git status -s -uno --ignore-submodules=none > actual &&
438 + git status -s -uno --ignore-submodules=none >actual &&
439 test_cmp expect.modified actual &&
440 git rm -f submod &&
441 test ! -d submod &&
448 - git status -s -uno --ignore-submodules=none > actual &&
442 + git status -s -uno --ignore-submodules=none >actual &&
443 test_cmp expect actual
444 '
445
@@ -461,16 +455,12 @@ test_expect_success 'setup submodule conflict' '
455 git add nitfol &&
456 git commit -m "added nitfol 2" &&
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 &&
460 git add submod &&
461 git commit -m "submod 1" &&
462 git checkout -b conflict2 master &&
471 - (cd submod &&
472 - git checkout branch2
473 - ) &&
463 + git -C submod checkout branch2 &&
464 git add submod &&
465 git commit -m "submod 2"
466 '
@@ -486,7 +476,7 @@ test_expect_success 'rm removes work tree of unmodified conflicted submodule' '
476 test_must_fail git merge conflict2 &&
477 git rm submod &&
478 test ! -d submod &&
489 - git status -s -uno --ignore-submodules=none > actual &&
479 + git status -s -uno --ignore-submodules=none >actual &&
480 test_cmp expect actual
481 '
482
@@ -494,18 +484,16 @@ test_expect_success 'rm of a conflicted populated submodule with different HEAD
484 git checkout conflict1 &&
485 git reset --hard &&
486 git submodule update &&
497 - (cd submod &&
498 - git checkout HEAD^
499 - ) &&
487 + git -C submod checkout HEAD^ &&
488 test_must_fail git merge conflict2 &&
489 test_must_fail git rm submod &&
490 test -d submod &&
491 test -f submod/.git &&
504 - git status -s -uno --ignore-submodules=none > actual &&
492 + git status -s -uno --ignore-submodules=none >actual &&
493 test_cmp expect.conflict actual &&
494 git rm -f submod &&
495 test ! -d submod &&
508 - git status -s -uno --ignore-submodules=none > actual &&
496 + git status -s -uno --ignore-submodules=none >actual &&
497 test_cmp expect actual &&
498 test_must_fail git config -f .gitmodules submodule.sub.url &&
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
503 git checkout conflict1 &&
504 git reset --hard &&
505 git submodule update &&
518 - (cd submod &&
519 - echo X >empty
520 - ) &&
506 + echo X >submod/empty &&
507 test_must_fail git merge conflict2 &&
508 test_must_fail git rm submod &&
509 test -d submod &&
510 test -f submod/.git &&
525 - git status -s -uno --ignore-submodules=none > actual &&
511 + git status -s -uno --ignore-submodules=none >actual &&
512 test_cmp expect.conflict actual &&
513 git rm -f submod &&
514 test ! -d submod &&
529 - git status -s -uno --ignore-submodules=none > actual &&
515 + git status -s -uno --ignore-submodules=none >actual &&
516 test_cmp expect actual &&
517 test_must_fail git config -f .gitmodules submodule.sub.url &&
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
522 git checkout conflict1 &&
523 git reset --hard &&
524 git submodule update &&
539 - (cd submod &&
540 - echo X >untracked
541 - ) &&
525 + echo X >submod/untracked &&
526 test_must_fail git merge conflict2 &&
527 test_must_fail git rm submod &&
528 test -d submod &&
529 test -f submod/.git &&
546 - git status -s -uno --ignore-submodules=none > actual &&
530 + git status -s -uno --ignore-submodules=none >actual &&
531 test_cmp expect.conflict actual &&
532 git rm -f submod &&
533 test ! -d submod &&
550 - git status -s -uno --ignore-submodules=none > actual &&
534 + git status -s -uno --ignore-submodules=none >actual &&
535 test_cmp expect actual
536 '
537
@@ -564,12 +548,12 @@ test_expect_success 'rm of a conflicted populated submodule with a .git director
548 test_must_fail git rm submod &&
549 test -d submod &&
550 test -d submod/.git &&
567 - git status -s -uno --ignore-submodules=none > actual &&
551 + git status -s -uno --ignore-submodules=none >actual &&
552 test_cmp expect.conflict actual &&
553 test_must_fail git rm -f submod &&
554 test -d submod &&
555 test -d submod/.git &&
572 - git status -s -uno --ignore-submodules=none > actual &&
556 + git status -s -uno --ignore-submodules=none >actual &&
557 test_cmp expect.conflict actual &&
558 git merge --abort &&
559 rm -rf submod
@@ -581,7 +565,7 @@ test_expect_success 'rm of a conflicted unpopulated submodule succeeds' '
565 test_must_fail git merge conflict2 &&
566 git rm submod &&
567 test ! -d submod &&
584 - git status -s -uno --ignore-submodules=none > actual &&
568 + git status -s -uno --ignore-submodules=none >actual &&
569 test_cmp expect actual
570 '
571
@@ -597,12 +581,12 @@ test_expect_success 'rm of a populated submodule with a .git directory fails eve
581 test_must_fail git rm submod &&
582 test -d submod &&
583 test -d submod/.git &&
600 - git status -s -uno --ignore-submodules=none > actual &&
584 + git status -s -uno --ignore-submodules=none >actual &&
585 ! test -s actual &&
586 test_must_fail git rm -f submod &&
587 test -d submod &&
588 test -d submod/.git &&
605 - git status -s -uno --ignore-submodules=none > actual &&
589 + git status -s -uno --ignore-submodules=none >actual &&
590 ! test -s actual &&
591 rm -rf submod
592 '
@@ -629,58 +613,52 @@ test_expect_success 'setup subsubmodule' '
613 test_expect_success 'rm recursively removes work tree of unmodified submodules' '
614 git rm submod &&
615 test ! -d submod &&
632 - git status -s -uno --ignore-submodules=none > actual &&
616 + git status -s -uno --ignore-submodules=none >actual &&
617 test_cmp expect actual
618 '
619
620 test_expect_success 'rm of a populated nested submodule with different nested HEAD fails unless forced' '
621 git reset --hard &&
622 git submodule update --recursive &&
639 - (cd submod/subsubmod &&
640 - git checkout HEAD^
641 - ) &&
623 + git -C submod/subsubmod checkout HEAD^ &&
624 test_must_fail git rm submod &&
625 test -d submod &&
626 test -f submod/.git &&
645 - git status -s -uno --ignore-submodules=none > actual &&
627 + git status -s -uno --ignore-submodules=none >actual &&
628 test_cmp expect.modified actual &&
629 git rm -f submod &&
630 test ! -d submod &&
649 - git status -s -uno --ignore-submodules=none > actual &&
631 + git status -s -uno --ignore-submodules=none >actual &&
632 test_cmp expect actual
633 '
634
635 test_expect_success 'rm of a populated nested submodule with nested modifications fails unless forced' '
636 git reset --hard &&
637 git submodule update --recursive &&
656 - (cd submod/subsubmod &&
657 - echo X >empty
658 - ) &&
638 + echo X >submod/subsubmod/empty &&
639 test_must_fail git rm submod &&
640 test -d submod &&
641 test -f submod/.git &&
662 - git status -s -uno --ignore-submodules=none > actual &&
642 + git status -s -uno --ignore-submodules=none >actual &&
643 test_cmp expect.modified actual &&
644 git rm -f submod &&
645 test ! -d submod &&
666 - git status -s -uno --ignore-submodules=none > actual &&
646 + git status -s -uno --ignore-submodules=none >actual &&
647 test_cmp expect actual
648 '
649
650 test_expect_success 'rm of a populated nested submodule with nested untracked files fails unless forced' '
651 git reset --hard &&
652 git submodule update --recursive &&
673 - (cd submod/subsubmod &&
674 - echo X >untracked
675 - ) &&
653 + echo X >submod/subsubmod/untracked &&
654 test_must_fail git rm submod &&
655 test -d submod &&
656 test -f submod/.git &&
679 - git status -s -uno --ignore-submodules=none > actual &&
657 + git status -s -uno --ignore-submodules=none >actual &&
658 test_cmp expect.modified actual &&
659 git rm -f submod &&
660 test ! -d submod &&
683 - git status -s -uno --ignore-submodules=none > actual &&
661 + git status -s -uno --ignore-submodules=none >actual &&
662 test_cmp expect actual
663 '
664
@@ -695,12 +673,12 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc
673 test_must_fail git rm submod &&
674 test -d submod &&
675 test -d submod/subsubmod/.git &&
698 - git status -s -uno --ignore-submodules=none > actual &&
676 + git status -s -uno --ignore-submodules=none >actual &&
677 ! test -s actual &&
678 test_must_fail git rm -f submod &&
679 test -d submod &&
680 test -d submod/subsubmod/.git &&
703 - git status -s -uno --ignore-submodules=none > actual &&
681 + git status -s -uno --ignore-submodules=none >actual &&
682 ! test -s actual &&
683 rm -rf submod
684 '
@@ -717,7 +695,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
695 echo "?? submod/" >expected &&
696 test_cmp expected actual &&
697 rm -rf submod &&
720 - git status -s -uno --ignore-submodules=none > actual &&
698 + git status -s -uno --ignore-submodules=none >actual &&
699 ! test -s actual
700 '
701