The test which is fixed by this patch 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 <[email protected]>
---
git-submodule.sh | 3 ++-
t/t7407-submodule-foreach.sh | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
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 f868636..776b349 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -187,7 +187,7 @@ Entering '../sub2'
Entering '../sub3'
EOF
-test_expect_failure 'test messages from "foreach --recursive" from
subdirectory' '
+test_expect_success 'test messages from "foreach --recursive" from
subdirectory' '
(
cd clone2 &&
mkdir untracked &&
--
2.8.0.rc4.23.gd22361a.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html