mingw: remove use of _getdrive() from lstat/fstat
[gitweb.git] / git-submodule.sh
index 4a95035d85d7563b84df15a09dc7c8160e9864ca..92be0feb5840c055061f680a45eef6c8f4ebda2d 100755 (executable)
@@ -35,6 +35,7 @@ resolve_relative_url ()
        remoteurl=$(git config "remote.$remote.url") ||
                die "remote ($remote) does not have a url defined in .git/config"
        url="$1"
+       remoteurl=${remoteurl%/}
        while test -n "$url"
        do
                case "$url" in
@@ -49,7 +50,7 @@ resolve_relative_url ()
                        break;;
                esac
        done
-       echo "$remoteurl/$url"
+       echo "$remoteurl/${url%/}"
 }
 
 #
@@ -633,6 +634,14 @@ cmd_sync()
        do
                name=$(module_name "$path")
                url=$(git config -f .gitmodules --get submodule."$name".url)
+
+               # Possibly a url relative to parent
+               case "$url" in
+               ./*|../*)
+                       url=$(resolve_relative_url "$url") || exit
+                       ;;
+               esac
+
                if test -e "$path"/.git
                then
                (