t/lib-httpd: recognize */smart/* repos as smart-http
[gitweb.git] / git-submodule.sh
index efc86ad4e0b90edbbf5a927aa87e7ad4b1a1949e..3d94a14079ccf745b3cf3d5d5a4e471f9b5542bc 100755 (executable)
@@ -167,10 +167,11 @@ module_clone()
        a=${a%/}
        b=${b%/}
 
-       rel=$(echo $b | sed -e 's|[^/]*|..|g')
+       # Turn each leading "*/" component into "../"
+       rel=$(echo $b | sed -e 's|[^/][^/]*|..|g')
        echo "gitdir: $rel/$a" >"$path/.git"
 
-       rel=$(echo $a | sed -e 's|[^/]*|..|g')
+       rel=$(echo $a | sed -e 's|[^/][^/]*|..|g')
        (clear_local_git_env; cd "$path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
 }