summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fa21b60)
raw | patch | inline | side by side (parent: fa21b60)
author | Gerrit Pape <pape@smarden.org> | |
Wed, 28 Mar 2007 09:46:15 +0000 (09:46 +0000) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 28 Mar 2007 11:44:16 +0000 (04:44 -0700) |
Please see http://bugs.debian.org/409887
http-fetch expected the URL given at the command line to have a trailing
slash anyway, and then added '/objects...' when requesting objects files
from the http server.
Now it doesn't require the trailing slash in <url> anymore, and strips
trailing slashes if given nonetheless.
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
http-fetch expected the URL given at the command line to have a trailing
slash anyway, and then added '/objects...' when requesting objects files
from the http server.
Now it doesn't require the trailing slash in <url> anymore, and strips
trailing slashes if given nonetheless.
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-clone.sh | patch | blob | history | |
git-fetch.sh | patch | blob | history | |
http-fetch.c | patch | blob | history |
diff --git a/git-clone.sh b/git-clone.sh
index 6ba477d1f4ee16c20e3fee7dd881f1645bcb80f1..513b574d13858f1a81e6f66251890d81bf0e55ce 100755 (executable)
--- a/git-clone.sh
+++ b/git-clone.sh
else
tname=$name
fi
- git-http-fetch $v -a -w "$tname" "$name" "$1/" || exit 1
+ git-http-fetch $v -a -w "$tname" "$name" "$1" || exit 1
done <"$clone_tmp/refs"
rm -fr "$clone_tmp"
http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
diff --git a/git-fetch.sh b/git-fetch.sh
index 93349330d45ad43c5c7e146a942d76b78c0e2ee9..fd70696b7479ad08eedbb44b75654f07247cc37b 100755 (executable)
--- a/git-fetch.sh
+++ b/git-fetch.sh
expr "z$head" : "z$_x40\$" >/dev/null ||
die "No such ref $remote_name at $remote"
echo >&2 "Fetching $remote_name from $remote using $proto"
- git-http-fetch -v -a "$head" "$remote/" || exit
+ git-http-fetch -v -a "$head" "$remote" || exit
;;
rsync://*)
test -n "$shallow_depth" &&
diff --git a/http-fetch.c b/http-fetch.c
index e6cd11db737e1ed79c3b60d33674c6e0ce38af55..58b77a7a18aa108cbe6476e42a5dfe1b3b419840 100644 (file)
--- a/http-fetch.c
+++ b/http-fetch.c
struct alt_base
{
- const char *base;
+ char *base;
int path_len;
int got_indices;
struct packed_git *packs;
SHA1_Init(&obj_req->c);
- url = xmalloc(strlen(obj_req->repo->base) + 50);
- obj_req->url = xmalloc(strlen(obj_req->repo->base) + 50);
+ url = xmalloc(strlen(obj_req->repo->base) + 51);
+ obj_req->url = xmalloc(strlen(obj_req->repo->base) + 51);
strcpy(url, obj_req->repo->base);
posn = url + strlen(obj_req->repo->base);
- strcpy(posn, "objects/");
- posn += 8;
+ strcpy(posn, "/objects/");
+ posn += 9;
memcpy(posn, hex, 2);
posn += 2;
*(posn++) = '/';
int len, baselen, ch;
baselen = strlen(base);
- len = baselen + 6; /* "refs/" + NUL */
+ len = baselen + 7; /* "/refs/" + NUL */
for (cp = ref; (ch = *cp) != 0; cp++, len++)
if (needs_quote(ch))
len += 2; /* extra two hex plus replacement % */
qref = xmalloc(len);
memcpy(qref, base, baselen);
- memcpy(qref + baselen, "refs/", 5);
- for (cp = ref, dp = qref + baselen + 5; (ch = *cp) != 0; cp++) {
+ memcpy(qref + baselen, "/refs/", 6);
+ for (cp = ref, dp = qref + baselen + 6; (ch = *cp) != 0; cp++) {
if (needs_quote(ch)) {
*dp++ = '%';
*dp++ = hex((ch >> 4) & 0xF);
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
alt = xmalloc(sizeof(*alt));
- alt->base = url;
+ alt->base = xmalloc(strlen(url) + 1);
+ strcpy(alt->base, url);
+ for (path = alt->base + strlen(alt->base) - 1; *path == '/'; --path)
+ *path = 0;
alt->got_indices = 0;
alt->packs = NULL;
alt->next = NULL;