From: Stefan Beller Date: Tue, 29 Mar 2016 22:23:43 GMT Subject: [PATCH 1/6] submodule foreach: correct path display in recursive submodules Message-ID: <1459290228-9069-2-git-send-email-sbeller@google.com> In-Reply-To: <1459290228-9069-1-git-send-email-sbeller@google.com> The new test replicates the previous test with the difference of executing from a sub directory. By executing from a sub directory all we would expect all displayed paths to be prefixed by '../'. Prior to this patch the test would report Entering 'nested1/nested2/../nested3' instead of the expected Entering '../nested1/nested2/nested3' because the prefix is put unconditionally in front and after that a computed display path with is affected by `wt_prefix`. This is wrong as any relative path computation would need to be at the front. By emptying the `wt_prefix` in recursive submodules and adding the information of any relative path into the `prefix` this is fixed. Signed-off-by: Stefan Beller --- git-submodule.sh | 3 ++- t/t7407-submodule-foreach.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/git-submodule.sh b/git-submodule.sh index 43c68de..2838069 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -417,10 +417,11 @@ cmd_foreach() say "$(eval_gettext "Entering '\$prefix\$displaypath'")" name=$(git submodule--helper name "$sm_path") ( - prefix="$prefix$sm_path/" + prefix="$(relative_path $prefix$sm_path)/" clear_local_git_env cd "$sm_path" && sm_path=$(relative_path "$sm_path") && + wt_prefix= # we make $path available to scripts ... path=$sm_path && if test $# -eq 1 diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh index 7ca10b8..776b349 100755 --- a/t/t7407-submodule-foreach.sh +++ b/t/t7407-submodule-foreach.sh @@ -178,6 +178,26 @@ test_expect_success 'test messages from "foreach --recursive"' ' ' cat > expect <../../actual + ) && + test_i18ncmp expect actual +' + +cat > expect <