X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-submodule.sh;fp=git-submodule.sh;h=a9e98224ae1a44013ff56dd6030c1ceb400a8818;hb=69c3051780d6cacfe242563296160634dc667a90;hp=c405caaa0ee6998c4bdd39f97c7d53edcdcbea48;hpb=d75219b4a8a9c44520ddca234cde992498383b89;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index c405caaa0..a9e98224a 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -132,30 +132,11 @@ module_clone() gitdir_base= name=$(module_name "$path" 2>/dev/null) test -n "$name" || name="$path" - base_path=$(dirname "$path") + base_name=$(dirname "$name") gitdir=$(git rev-parse --git-dir) - gitdir_base="$gitdir/modules/$base_path" - gitdir="$gitdir/modules/$path" - - case $gitdir in - /*) - a="$(cd_to_toplevel && pwd)/" - b=$gitdir - while [ "$b" ] && [ "${a%%/*}" = "${b%%/*}" ] - do - a=${a#*/} b=${b#*/}; - done - - rel="$a$name" - rel=`echo $rel | sed -e 's|[^/]*|..|g'` - rel_gitdir="$rel/$b" - ;; - *) - rel=`echo $name | sed -e 's|[^/]*|..|g'` - rel_gitdir="$rel/$gitdir" - ;; - esac + gitdir_base="$gitdir/modules/$base_name" + gitdir="$gitdir/modules/$name" if test -d "$gitdir" then @@ -168,8 +149,6 @@ module_clone() die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")" fi - echo "gitdir: $rel_gitdir" >"$path/.git" - a=$(cd "$gitdir" && pwd)/ b=$(cd "$path" && pwd)/ # Remove all common leading directories after a sanity check @@ -185,6 +164,9 @@ module_clone() a=${a%/} b=${b%/} + rel=$(echo $b | sed -e 's|[^/]*|..|g') + echo "gitdir: $rel/$a" >"$path/.git" + rel=$(echo $a | sed -e 's|[^/]*|..|g') (clear_local_git_env; cd "$path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b") }