X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=git-submodule.sh;h=9210f3af564356be7cccf02307b2045084b4357a;hb=646e41753568683c3ffde6b7f614f880311cc984;hp=5629d875e6a0c0a390d046f28bf2d768116bf974;hpb=faae8854bfb18da013e0a41d061dbbe73b3c9c73;p=~andy%2Fgit diff --git a/git-submodule.sh b/git-submodule.sh index 5629d875e..9210f3af5 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -181,13 +181,18 @@ module_clone() rm -f "$gitdir/index" else mkdir -p "$gitdir_base" - git clone $quiet -n ${reference:+"$reference"} \ - --separate-git-dir "$gitdir" "$url" "$sm_path" || + ( + clear_local_git_env + git clone $quiet -n ${reference:+"$reference"} \ + --separate-git-dir "$gitdir" "$url" "$sm_path" + ) || die "$(eval_gettext "Clone of '\$url' into submodule path '\$sm_path' failed")" fi - a=$(cd "$gitdir" && pwd)/ - b=$(cd "$sm_path" && pwd)/ + # We already are at the root of the work tree but cd_to_toplevel will + # resolve any symlinks that might be present in $PWD + a=$(cd_to_toplevel && cd "$gitdir" && pwd)/ + b=$(cd_to_toplevel && cd "$sm_path" && pwd)/ # normalize Windows-style absolute paths to POSIX-style absolute paths case $a in [a-zA-Z]:/*) a=/${a%%:*}${a#*:} ;; esac case $b in [a-zA-Z]:/*) b=/${b%%:*}${b#*:} ;; esac