summaryrefslogtreecommitdiff
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-10-10 10:56:11 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-10 13:30:31 -0700
commit3389e78ec8cd117f981ce3963a901b66db6c8206 (patch)
tree59153ebc7d37be11d8e19ab9a5b875667e8984b0 /builtin/submodule--helper.c
parent087885049e38c38a437153055ff521567132b183 (diff)
downloadgit-3389e78ec8cd117f981ce3963a901b66db6c8206.tar.gz
submodule: ignore trailing slash in relative url
This is similar to the previous patch, though no user reported a bug and I could not find a regressive behavior. However it is a good thing to be strict on the output and for that we always omit a trailing slash. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 612e87084c..569bc8cf3d 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -149,6 +149,8 @@ static char *relative_url(const char *remote_url,
}
strbuf_reset(&sb);
strbuf_addf(&sb, "%s%s%s", remoteurl, colonsep ? ":" : "/", url);
+ if (ends_with(url, "/"))
+ strbuf_setlen(&sb, sb.len - 1);
free(remoteurl);
if (starts_with_dot_slash(sb.buf))