summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-03-05 13:13:09 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-03-05 13:13:10 -0800
commit3630be2749819b79de917a77c6627e3f84c00a11 (patch)
treea2a7fe1e31a4817b0f1b0d8548a6d5c9ed931a20
parentMerge branch 'jk/prune-mtime' into maint (diff)
parentgit-submodule.sh: fix '/././' path normalization (diff)
downloadtgif-3630be2749819b79de917a77c6627e3f84c00a11.tar.xz
Merge branch 'ps/submodule-sanitize-path-upon-add' into maint
"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 9245abfd42..36797c3c00 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 7c88245031..5811a982f4 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 &&