@@ -175,7 +175,7 @@ test_expect_success 'submodule update does not fetch already present commits' '
175175 git submodule update > ../actual 2> ../actual.err
176176 ) &&
177177 test_i18ncmp expected actual &&
178- ! test -s actual.err
178+ test_must_be_empty actual.err
179179'
180180
181181test_expect_success ' submodule update should fail due to local changes' '
@@ -482,7 +482,8 @@ test_expect_success 'recursive submodule update - command in .git/config catches
482482
483483test_expect_success ' submodule init does not copy command into .git/config' '
484484 (cd super &&
485- H=$(git ls-files -s submodule | cut -d" " -f2) &&
485+ git ls-files -s submodule >out &&
486+ H=$(cut -d" " -f2 out) &&
486487 mkdir submodule1 &&
487488 git update-index --add --cacheinfo 160000 $H submodule1 &&
488489 git config -f .gitmodules submodule.submodule1.path submodule1 &&
@@ -580,9 +581,11 @@ test_expect_success 'submodule update - update=none in .git/config' '
580581 git checkout master &&
581582 compare_head
582583 ) &&
583- git diff --raw | grep " submodule" &&
584+ git diff --name-only >out &&
585+ grep ^submodule$ out &&
584586 git submodule update &&
585- git diff --raw | grep " submodule" &&
587+ git diff --name-only >out &&
588+ grep ^submodule$ out &&
586589 (cd submodule &&
587590 compare_head
588591 ) &&
@@ -598,11 +601,13 @@ test_expect_success 'submodule update - update=none in .git/config but --checkou
598601 git checkout master &&
599602 compare_head
600603 ) &&
601- git diff --raw | grep " submodule" &&
604+ git diff --name-only >out &&
605+ grep ^submodule$ out &&
602606 git submodule update --checkout &&
603- test_must_fail git diff --raw \| grep " submodule" &&
607+ git diff --name-only >out &&
608+ ! grep ^submodule$ out &&
604609 (cd submodule &&
605- test_must_fail compare_head
610+ ! compare_head
606611 ) &&
607612 git config --unset submodule.submodule.update
608613 )
@@ -616,8 +621,8 @@ test_expect_success 'submodule update --init skips submodule with update=none' '
616621 git clone super cloned &&
617622 (cd cloned &&
618623 git submodule update --init &&
619- test -e submodule/.git &&
620- test_must_fail test -e none/.git
624+ test_path_exists submodule/.git &&
625+ test_path_is_missing none/.git
621626 )
622627'
623628
@@ -886,7 +891,8 @@ test_expect_success 'submodule update properly revives a moved submodule' '
886891 H=$(git rev-parse --short HEAD) &&
887892 git commit -am "pre move" &&
888893 H2=$(git rev-parse --short HEAD) &&
889- git status | sed "s/$H/XXX/" >expect &&
894+ git status >out &&
895+ sed "s/$H/XXX/" out >expect &&
890896 H=$(cd submodule2 && git rev-parse HEAD) &&
891897 git rm --cached submodule2 &&
892898 rm -rf submodule2 &&
@@ -895,7 +901,8 @@ test_expect_success 'submodule update properly revives a moved submodule' '
895901 git config -f .gitmodules submodule.submodule2.path "moved/sub module" &&
896902 git commit -am "post move" &&
897903 git submodule update &&
898- git status | sed "s/$H2/XXX/" >actual &&
904+ git status > out &&
905+ sed "s/$H2/XXX/" out >actual &&
899906 test_cmp expect actual
900907 )
901908'
@@ -913,7 +920,7 @@ test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd'
913920
914921test_expect_success ' submodule update clone shallow submodule' '
915922 test_when_finished "rm -rf super3" &&
916- first=$(git -C cloned submodule status submodule |cut -c2-41 ) &&
923+ first=$(git -C cloned rev-parse HEAD: submodule) &&
917924 second=$(git -C submodule rev-parse HEAD) &&
918925 commit_count=$(git -C submodule rev-list --count $first^..$second) &&
919926 git clone cloned super3 &&
@@ -923,7 +930,8 @@ test_expect_success 'submodule update clone shallow submodule' '
923930 sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
924931 mv -f .gitmodules.tmp .gitmodules &&
925932 git submodule update --init --depth=$commit_count &&
926- test 1 = $(git -C submodule log --oneline | wc -l)
933+ git -C submodule log --oneline >out &&
934+ test_line_count = 1 out
927935 )
928936'
929937
@@ -939,7 +947,8 @@ test_expect_success 'submodule update clone shallow submodule outside of depth'
939947 test_i18ngrep "Direct fetching of that commit failed." actual &&
940948 git -C ../submodule config uploadpack.allowReachableSHA1InWant true &&
941949 git submodule update --init --depth=1 >actual &&
942- test 1 = $(git -C submodule log --oneline | wc -l)
950+ git -C submodule log --oneline >out &&
951+ test_line_count = 1 out
943952 )
944953'
945954
0 commit comments