Note that relative repository arguments passed to
$ git submodule add <repository> [<path>]
are expanded relative to the superproject's remote URL, not relative
to the current working directory.
Signed-off-by: W. Trevor King <wking@tremily.us>
else
die "$(eval_gettext "'\$sm_path' already exists and is not a valid git repo")"
fi
-
+ # if the submodule's remote URL is not set, set it
+ up_path=$(get_up_path "$sm_path")
+ sub_url=$(join_urls "$up_path" "$realrepo")
+ (
+ clear_local_git_env
+ cd "$sm_path" &&
+ remote=$(get_default_remote) &&
+ if ! git config remote."$remote".url > /dev/null 2>/dev/null
+ then
+ git config remote."$remote".url "$sub_url"
+ fi
+ ) || die "$(eval_gettext "Unable to configure submodule remote '\$sm_path'")"
else
module_clone "$sm_path" "$realrepo" "$reference" || exit