git-submodule.sh: fix '/././' path normalization
When we add a new submodule the path of the submodule is being normalized. We fail to normalize multiple adjacent '/./', though. Thus 'path/to/././submodule' will become 'path/to/./submodule' where it should be 'path/to/submodule' instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3d8a54eb37
commit
8196e72895
@ -420,7 +420,7 @@ cmd_add()
|
|||||||
sed -e '
|
sed -e '
|
||||||
s|//*|/|g
|
s|//*|/|g
|
||||||
s|^\(\./\)*||
|
s|^\(\./\)*||
|
||||||
s|/\./|/|g
|
s|/\(\./\)*|/|g
|
||||||
:start
|
:start
|
||||||
s|\([^/]*\)/\.\./||
|
s|\([^/]*\)/\.\./||
|
||||||
tstart
|
tstart
|
||||||
|
@ -171,6 +171,23 @@ test_expect_success 'submodule add with ./ in path' '
|
|||||||
test_cmp empty untracked
|
test_cmp empty untracked
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'submodule add with /././ in path' '
|
||||||
|
echo "refs/heads/master" >expect &&
|
||||||
|
>empty &&
|
||||||
|
|
||||||
|
(
|
||||||
|
cd addtest &&
|
||||||
|
git submodule add "$submodurl" dotslashdotsubmod/././frotz/./ &&
|
||||||
|
git submodule init
|
||||||
|
) &&
|
||||||
|
|
||||||
|
rm -f heads head untracked &&
|
||||||
|
inspect addtest/dotslashdotsubmod/frotz ../../.. &&
|
||||||
|
test_cmp expect heads &&
|
||||||
|
test_cmp expect head &&
|
||||||
|
test_cmp empty untracked
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'submodule add with // in path' '
|
test_expect_success 'submodule add with // in path' '
|
||||||
echo "refs/heads/master" >expect &&
|
echo "refs/heads/master" >expect &&
|
||||||
>empty &&
|
>empty &&
|
||||||
|
Loading…
Reference in New Issue
Block a user