From: Junio C Hamano Date: Mon, 20 Aug 2018 18:33:48 +0000 (-0700) Subject: Merge branch 'en/t7406-fixes' X-Git-Tag: v2.19.0-rc0~31 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/02c51a2fd8ef3bfb89bc0967ff52632b328acf6b?hp=-c Merge branch 'en/t7406-fixes' Test fixes. * en/t7406-fixes: t7406: avoid using test_must_fail for commands other than git t7406: prefer test_* helper functions to test -[feds] t7406: avoid having git commands upstream of a pipe t7406: simplify by using diff --name-only instead of diff --raw t7406: fix call that was failing for the wrong reason --- 02c51a2fd8ef3bfb89bc0967ff52632b328acf6b diff --combined t/t7406-submodule-update.sh index 686e6a439e,815b60cb59..10dc91620a --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@@ -115,17 -115,17 +115,17 @@@ Submodule path '../super/submodule': ch EOF cat <expect2 +Cloning into '$pwd/recursivesuper/super/merging'... +Cloning into '$pwd/recursivesuper/super/none'... +Cloning into '$pwd/recursivesuper/super/rebasing'... +Cloning into '$pwd/recursivesuper/super/submodule'... Submodule 'merging' ($pwd/merging) registered for path '../super/merging' Submodule 'none' ($pwd/none) registered for path '../super/none' Submodule 'rebasing' ($pwd/rebasing) registered for path '../super/rebasing' Submodule 'submodule' ($pwd/submodule) registered for path '../super/submodule' -Cloning into '$pwd/recursivesuper/super/merging'... done. -Cloning into '$pwd/recursivesuper/super/none'... done. -Cloning into '$pwd/recursivesuper/super/rebasing'... done. -Cloning into '$pwd/recursivesuper/super/submodule'... done. EOF @@@ -137,8 -137,7 +137,8 @@@ test_expect_success 'submodule update - git submodule update --init --recursive ../super >../../actual 2>../../actual2 ) && test_i18ncmp expect actual && - test_i18ncmp expect2 actual2 + sort actual2 >actual2.sorted && + test_i18ncmp expect2 actual2.sorted ' cat <expect2 @@@ -175,7 -174,7 +175,7 @@@ test_expect_success 'submodule update d git submodule update > ../actual 2> ../actual.err ) && test_i18ncmp expected actual && - ! test -s actual.err + test_must_be_empty actual.err ' test_expect_success 'submodule update should fail due to local changes' ' @@@ -482,7 -481,8 +482,8 @@@ test_expect_success 'recursive submodul test_expect_success 'submodule init does not copy command into .git/config' ' (cd super && - H=$(git ls-files -s submodule | cut -d" " -f2) && + git ls-files -s submodule >out && + H=$(cut -d" " -f2 out) && mkdir submodule1 && git update-index --add --cacheinfo 160000 $H submodule1 && git config -f .gitmodules submodule.submodule1.path submodule1 && @@@ -580,9 -580,11 +581,11 @@@ test_expect_success 'submodule update git checkout master && compare_head ) && - git diff --raw | grep " submodule" && + git diff --name-only >out && + grep ^submodule$ out && git submodule update && - git diff --raw | grep " submodule" && + git diff --name-only >out && + grep ^submodule$ out && (cd submodule && compare_head ) && @@@ -598,11 -600,13 +601,13 @@@ test_expect_success 'submodule update git checkout master && compare_head ) && - git diff --raw | grep " submodule" && + git diff --name-only >out && + grep ^submodule$ out && git submodule update --checkout && - test_must_fail git diff --raw \| grep " submodule" && + git diff --name-only >out && + ! grep ^submodule$ out && (cd submodule && - test_must_fail compare_head + ! compare_head ) && git config --unset submodule.submodule.update ) @@@ -616,8 -620,8 +621,8 @@@ test_expect_success 'submodule update - git clone super cloned && (cd cloned && git submodule update --init && - test -e submodule/.git && - test_must_fail test -e none/.git + test_path_exists submodule/.git && + test_path_is_missing none/.git ) ' @@@ -886,7 -890,8 +891,8 @@@ test_expect_success 'submodule update p H=$(git rev-parse --short HEAD) && git commit -am "pre move" && H2=$(git rev-parse --short HEAD) && - git status | sed "s/$H/XXX/" >expect && + git status >out && + sed "s/$H/XXX/" out >expect && H=$(cd submodule2 && git rev-parse HEAD) && git rm --cached submodule2 && rm -rf submodule2 && @@@ -895,7 -900,8 +901,8 @@@ git config -f .gitmodules submodule.submodule2.path "moved/sub module" && git commit -am "post move" && git submodule update && - git status | sed "s/$H2/XXX/" >actual && + git status > out && + sed "s/$H2/XXX/" out >actual && test_cmp expect actual ) ' @@@ -913,7 -919,7 +920,7 @@@ test_expect_success SYMLINKS 'submodul test_expect_success 'submodule update clone shallow submodule' ' test_when_finished "rm -rf super3" && - first=$(git -C cloned submodule status submodule |cut -c2-41) && + first=$(git -C cloned rev-parse HEAD:submodule) && second=$(git -C submodule rev-parse HEAD) && commit_count=$(git -C submodule rev-list --count $first^..$second) && git clone cloned super3 && @@@ -923,7 -929,8 +930,8 @@@ sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp && mv -f .gitmodules.tmp .gitmodules && git submodule update --init --depth=$commit_count && - test 1 = $(git -C submodule log --oneline | wc -l) + git -C submodule log --oneline >out && + test_line_count = 1 out ) ' @@@ -939,7 -946,8 +947,8 @@@ test_expect_success 'submodule update c test_i18ngrep "Direct fetching of that commit failed." actual && git -C ../submodule config uploadpack.allowReachableSHA1InWant true && git submodule update --init --depth=1 >actual && - test 1 = $(git -C submodule log --oneline | wc -l) + git -C submodule log --oneline >out && + test_line_count = 1 out ) '