summaryrefslogtreecommitdiff
path: root/builtin-clone.c
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2008-09-01 19:07:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-09-02 06:27:39 (GMT)
commit86521acaca0cb9951d9ff5ac4bc2c736035267a0 (patch)
treef594fc5469dd37179a928d85ebe65639a02757ab /builtin-clone.c
parentf733c70941a79e8d7a05d16fac89294ef0366bda (diff)
downloadgit-86521acaca0cb9951d9ff5ac4bc2c736035267a0.zip
git-86521acaca0cb9951d9ff5ac4bc2c736035267a0.tar.gz
git-86521acaca0cb9951d9ff5ac4bc2c736035267a0.tar.bz2
Bring local clone's origin URL in line with that of a remote clone
On a local clone, "git clone" would use the fully DWIMmed path as the origin URL in the resulting repo. This was slightly inconsistent with the case of a remote clone where the _given_ URL was used as the origin URL (because the DWIMming was done remotely, and was therefore not available to "git clone"). This behaviour caused problems when cloning a local non-bare repo with relative submodule URLs, because these submodule URLs would then be resolved against the DWIMmed URL (e.g. "/repo/.git") instead of the given URL (e.g. "/repo"). This patch teaches "git clone" to use the _given_ URL - instead of the DWIMmed path - as the origin URL. This causes relative submodule URLs to be resolved correctly, as long the _given_ URL indicates the correct directory against which the submodule URLs should be resolved. The patch also updates a testcase that contained the old-style origin URLs. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-clone.c')
-rw-r--r--builtin-clone.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-clone.c b/builtin-clone.c
index c0e3086..f44ecea 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -387,7 +387,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
path = get_repo_path(repo_name, &is_bundle);
if (path)
- repo = path;
+ repo = xstrdup(make_nonrelative_path(repo_name));
else if (!strchr(repo_name, ':'))
repo = xstrdup(make_absolute_path(repo_name));
else