diff options
Diffstat (limited to 't/lib-submodule-update.sh')
-rw-r--r-- | t/lib-submodule-update.sh | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 2d31fcfda1..36f767cb74 100644 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -168,20 +168,16 @@ replace_gitfile_with_git_dir () { # Note that this only supports submodules at the root level of the # superproject, with the default name, i.e. same as its path. test_git_directory_is_unchanged () { - ( - cd ".git/modules/$1" && - # does core.worktree point at the right place? - test "$(git config core.worktree)" = "../../../$1" && - # remove it temporarily before comparing, as - # "$1/.git/config" lacks it... - git config --unset core.worktree - ) && + # does core.worktree point at the right place? + echo "../../../$1" >expect && + git -C ".git/modules/$1" config core.worktree >actual && + test_cmp expect actual && + # remove it temporarily before comparing, as + # "$1/.git/config" lacks it... + git -C ".git/modules/$1" config --unset core.worktree && diff -r ".git/modules/$1" "$1/.git" && - ( - # ... and then restore. - cd ".git/modules/$1" && - git config core.worktree "../../../$1" - ) + # ... and then restore. + git -C ".git/modules/$1" config core.worktree "../../../$1" } test_git_directory_exists () { @@ -189,7 +185,9 @@ test_git_directory_exists () { if test -f sub1/.git then # does core.worktree point at the right place? - test "$(git -C .git/modules/$1 config core.worktree)" = "../../../$1" + echo "../../../$1" >expect && + git -C ".git/modules/$1" config core.worktree >actual && + test_cmp expect actual fi } @@ -804,7 +802,7 @@ test_submodule_recursing_with_args_common () { git branch -t no_submodule origin/no_submodule && $command no_submodule && test_superproject_content origin/no_submodule && - ! test_path_is_dir sub1 && + test_path_is_missing sub1 && test_must_fail git config -f .git/modules/sub1/config core.worktree && test_must_fail git config -f .git/modules/sub1/modules/sub2/config core.worktree ) @@ -832,7 +830,7 @@ test_submodule_recursing_with_args_common () { cd submodule_update && git branch -t invalid_sub1 origin/invalid_sub1 && test_must_fail $command invalid_sub1 2>err && - test_i18ngrep sub1 err && + test_grep sub1 err && test_superproject_content origin/add_sub1 && test_submodule_content sub1 origin/add_sub1 ) |