Code

Makefile: fix permissions of mergetools/ checked out with permissive umask
[git.git] / git-submodule.sh
index 3daa0c834cad1ed402376adf535c73e1c06172e4..f46862f61b48a970f6ec24a9ae7624905ba3013a 100755 (executable)
@@ -35,7 +35,7 @@ resolve_relative_url ()
 {
        remote=$(get_default_remote)
        remoteurl=$(git config "remote.$remote.url") ||
-               die "$(eval_gettext "remote (\$remote) does not have a url defined in .git/config")"
+               remoteurl=$(pwd) # the repository is its own authoritative upstream
        url="$1"
        remoteurl=${remoteurl%/}
        sep=/
@@ -122,12 +122,17 @@ module_clone()
        path=$1
        url=$2
        reference="$3"
+       quiet=
+       if test -n "$GIT_QUIET"
+       then
+               quiet=-q
+       fi
 
        if test -n "$reference"
        then
-               git-clone "$reference" -n "$url" "$path"
+               git-clone $quiet "$reference" -n "$url" "$path"
        else
-               git-clone -n "$url" "$path"
+               git-clone $quiet -n "$url" "$path"
        fi ||
        die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")"
 }
@@ -242,14 +247,6 @@ Use -f if you really want to add it." &&
                        die "$(eval_gettext "'\$path' already exists and is not a valid git repo")"
                fi
 
-               case "$repo" in
-               ./*|../*)
-                       url=$(resolve_relative_url "$repo") || exit
-                   ;;
-               *)
-                       url="$repo"
-                       ;;
-               esac
        else
 
                module_clone "$path" "$realrepo" "$reference" || exit
@@ -263,7 +260,7 @@ Use -f if you really want to add it." &&
                        esac
                ) || die "$(eval_gettext "Unable to checkout submodule '\$path'")"
        fi
-       git config submodule."$path".url "$url"
+       git config submodule."$path".url "$realrepo"
 
        git add $force "$path" ||
        die "$(eval_gettext "Failed to add submodule '\$path'")"