Code

http.c: remove verification of remote packs
authorTay Ray Chuan <rctay89@gmail.com>
Wed, 9 Sep 2009 12:33:50 +0000 (20:33 +0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Sep 2009 08:45:36 +0000 (01:45 -0700)
Make http.c::fetch_pack_index() no longer check for the remote pack
with a HEAD request before fetching the corresponding pack index file.

Not only does sending a HEAD request before we do a GET incur a
performance penalty, it does not offer any significant error-
prevention advantages (pack fetching in the *_http_pack_request()
methods is capable of handling any errors on its own).

This addresses an issue raised elsewhere:

  http://code.google.com/p/msysgit/issues/detail?id=323
  http://support.github.com/discussions/repos/957-cant-clone-over-http-or-git

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c

diff --git a/http.c b/http.c
index d60f7f7679459fe5e5ce64daf7152bd83535b632..d0cc1b3340cdbdd7f9aa57beb6eea548953ec8c6 100644 (file)
--- a/http.c
+++ b/http.c
@@ -869,17 +869,6 @@ static int fetch_pack_index(unsigned char *sha1, const char *base_url)
        char *url;
        struct strbuf buf = STRBUF_INIT;
 
-       /* Don't use the index if the pack isn't there */
-       end_url_with_slash(&buf, base_url);
-       strbuf_addf(&buf, "objects/pack/pack-%s.pack", hex);
-       url = strbuf_detach(&buf, 0);
-
-       if (http_get_strbuf(url, NULL, 0)) {
-               ret = error("Unable to verify pack %s is available",
-                           hex);
-               goto cleanup;
-       }
-
        if (has_pack_index(sha1)) {
                ret = 0;
                goto cleanup;