diff options
Diffstat (limited to 't/t7406-submodule-update.sh')
-rwxr-xr-x | t/t7406-submodule-update.sh | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index f604ef7a72..e87164aa8f 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -115,17 +115,17 @@ Submodule path '../super/submodule': checked out '$submodulesha1' EOF cat <<EOF >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,7 +137,8 @@ test_expect_success 'submodule update --init --recursive from subdirectory' ' 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 <<EOF >expect2 @@ -174,7 +175,7 @@ test_expect_success 'submodule update does not fetch already present commits' ' 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' ' @@ -481,7 +482,8 @@ test_expect_success 'recursive submodule update - command in .git/config catches 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 && @@ -579,9 +581,11 @@ test_expect_success 'submodule update - update=none in .git/config' ' 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 ) && @@ -597,11 +601,13 @@ test_expect_success 'submodule update - update=none in .git/config but --checkou 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 ) @@ -615,8 +621,8 @@ test_expect_success 'submodule update --init skips submodule with update=none' ' 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 ) ' @@ -783,7 +789,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir' ' (cd .git/modules/deeper/submodule && git log > ../../../../actual ) && - test_cmp actual expected + test_cmp expected actual ) ' @@ -801,7 +807,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir' ' (cd .git/modules/deeper/submodule && git log > ../../../../actual ) && - test_cmp actual expected + test_cmp expected actual ) ' @@ -821,7 +827,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir recur git add deeper/submodule && git commit -m "update submodule" && git push origin : && - test_cmp actual expected + test_cmp expected actual ) ' @@ -868,7 +874,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re (cd .git/modules/submodule/modules/subsubmodule && git log > ../../../../../actual ) && - test_cmp actual expected + test_cmp expected actual ) ' @@ -885,7 +891,8 @@ test_expect_success 'submodule update properly revives a moved submodule' ' 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 && @@ -894,7 +901,8 @@ test_expect_success 'submodule update properly revives a moved submodule' ' 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 ) ' @@ -912,7 +920,7 @@ test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd' 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 && @@ -922,7 +930,8 @@ test_expect_success 'submodule update clone shallow submodule' ' 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 ) ' @@ -938,7 +947,8 @@ test_expect_success 'submodule update clone shallow submodule outside of depth' 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 ) ' |