diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-08-16 12:41:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-16 12:41:13 -0700 |
commit | f4af7f19639457d71c4e9b53892b937468824cac (patch) | |
tree | 7da4b356951fc0be359dc145939878e941794c6f /git-submodule.sh | |
parent | 2a764974271aa36101b241fef8e2945db9b418a5 (diff) | |
parent | f22a17e8da25a043950a13f11035930922bb86e7 (diff) | |
download | git-f4af7f19639457d71c4e9b53892b937468824cac.tar.gz |
Merge branch 'jl/submodule-add-relurl-wo-upstream' into maint
* jl/submodule-add-relurl-wo-upstream:
submodule add: clean up duplicated code
submodule add: allow relative repository path even when no url is set
submodule add: test failure when url is not configured in superproject
Conflicts:
git-submodule.sh
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index 20c9bec970..f8ea3bf6f2 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -34,7 +34,7 @@ resolve_relative_url () { remote=$(get_default_remote) remoteurl=$(git config "remote.$remote.url") || - die "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=/ @@ -238,14 +238,6 @@ cmd_add() die "'$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 @@ -259,7 +251,7 @@ cmd_add() esac ) || die "Unable to checkout submodule '$path'" fi - git config submodule."$path".url "$url" + git config submodule."$path".url "$realrepo" git add $force "$path" || die "Failed to add submodule '$path'" |