Skip to content

Commit

Permalink
Merge branch 'ps/submodule-sanitize-path-upon-add'
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Feb 22, 2015
2 parents f11f76b + 8196e72 commit 070f6fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ cmd_add()
sed -e '
s|//*|/|g
s|^\(\./\)*||
s|/\./|/|g
s|/\(\./\)*|/|g
:start
s|\([^/]*\)/\.\./||
tstart
Expand Down
17 changes: 17 additions & 0 deletions t/t7400-submodule-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ test_expect_success 'submodule add with ./ in path' '
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' '
echo "refs/heads/master" >expect &&
>empty &&
Expand Down

0 comments on commit 070f6fe

Please sign in to comment.