summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-07-22 14:24:35 -0700
committerJunio C Hamano <gitster@pobox.com>2011-07-22 14:24:35 -0700
commitc56dce3b811400e73e7b68464cf229aa0edb9d8f (patch)
treeda27f15acf73ca6f932c32d2e71a40e73c853e30 /git-submodule.sh
parented16d0dbf11128e1f92b39a373a83442fa6d5051 (diff)
parentf22a17e8da25a043950a13f11035930922bb86e7 (diff)
downloadgit-c56dce3b811400e73e7b68464cf229aa0edb9d8f.tar.gz
Merge branch 'jl/submodule-add-relurl-wo-upstream'
* 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-xgit-submodule.sh12
1 files changed, 2 insertions, 10 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 3daa0c834c..bc1d3fa663 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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=/
@@ -242,14 +242,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 +255,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'")"