Skip to content

Commit 070f6fe

Browse files
committed
Merge branch 'ps/submodule-sanitize-path-upon-add'
"git submodule add" failed to squash "path/to/././submodule" to "path/to/submodule". * ps/submodule-sanitize-path-upon-add: git-submodule.sh: fix '/././' path normalization
2 parents f11f76b + 8196e72 commit 070f6fe

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

git-submodule.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ cmd_add()
423423
sed -e '
424424
s|//*|/|g
425425
s|^\(\./\)*||
426-
s|/\./|/|g
426+
s|/\(\./\)*|/|g
427427
:start
428428
s|\([^/]*\)/\.\./||
429429
tstart

t/t7400-submodule-basic.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,23 @@ test_expect_success 'submodule add with ./ in path' '
171171
test_cmp empty untracked
172172
'
173173

174+
test_expect_success 'submodule add with /././ in path' '
175+
echo "refs/heads/master" >expect &&
176+
>empty &&
177+
178+
(
179+
cd addtest &&
180+
git submodule add "$submodurl" dotslashdotsubmod/././frotz/./ &&
181+
git submodule init
182+
) &&
183+
184+
rm -f heads head untracked &&
185+
inspect addtest/dotslashdotsubmod/frotz ../../.. &&
186+
test_cmp expect heads &&
187+
test_cmp expect head &&
188+
test_cmp empty untracked
189+
'
190+
174191
test_expect_success 'submodule add with // in path' '
175192
echo "refs/heads/master" >expect &&
176193
>empty &&

0 commit comments

Comments
 (0)