aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-02-22 12:28:26 -0800
committerJunio C Hamano <gitster@pobox.com>2015-02-22 12:28:26 -0800
commit070f6fed052ca0cf6625f6566d23c71530d7abf9 (patch)
treec57a80e0f3dcfee9c129f8a4252c5abb035c9f89
parentf11f76b2bbcd23fe403744c055456a0bdf0981e7 (diff)
parent8196e728955a084303e99affff2ebc1120112516 (diff)
downloadgit-070f6fed052ca0cf6625f6566d23c71530d7abf9.tar.gz
git-070f6fed052ca0cf6625f6566d23c71530d7abf9.tar.xz
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
-rwxr-xr-xgit-submodule.sh2
-rwxr-xr-xt/t7400-submodule-basic.sh17
2 files changed, 18 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 9245abfd4..36797c3c0 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -423,7 +423,7 @@ cmd_add()
sed -e '
s|//*|/|g
s|^\(\./\)*||
- s|/\./|/|g
+ s|/\(\./\)*|/|g
:start
s|\([^/]*\)/\.\./||
tstart
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 7c8824503..5811a982f 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -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 &&