diff options
author | Jeff King <peff@peff.net> | 2015-01-27 15:02:27 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-01-27 12:41:45 -0800 |
commit | 8b9c2dd4dee01b5a0a9c5cfdd5a107f78edaceb7 (patch) | |
tree | de84a902180787109e9a66c6f7df0f36c0342ad0 /http.c | |
parent | 282616c72d1d08a77ca4fe1186cb708c38408d87 (diff) | |
download | git-8b9c2dd4dee01b5a0a9c5cfdd5a107f78edaceb7.tar.gz git-8b9c2dd4dee01b5a0a9c5cfdd5a107f78edaceb7.tar.xz |
dumb-http: do not pass NULL path to parse_pack_index
Once upon a time, dumb http always fetched .idx files
directly into their final location, and then checked their
validity with parse_pack_index. This was refactored in
commit 750ef42 (http-fetch: Use temporary files for
pack-*.idx until verified, 2010-04-19), which uses the
following logic:
1. If we have the idx already in place, see if it's
valid (using parse_pack_index). If so, use it.
2. Otherwise, fetch the .idx to a tempfile, check
that, and if so move it into place.
3. Either way, fetch the pack itself if necessary.
However, it got step 1 wrong. We pass a NULL path parameter
to parse_pack_index, so an existing .idx file always looks
broken. Worse, we do not treat this broken .idx as an
opportunity to re-fetch, but instead return an error,
ignoring the pack entirely. This can lead to a dumb-http
fetch failing to retrieve the necessary objects.
This doesn't come up much in practice, because it must be a
packfile that we found out about (and whose .idx we stored)
during an earlier dumb-http fetch, but whose packfile we
_didn't_ fetch. I.e., we did a partial clone of a
repository, didn't need some packfiles, and now a followup
fetch needs them.
Discovery and tests by Charles Bailey <charles@hashpling.org>.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1157,7 +1157,7 @@ static int fetch_and_setup_pack_index(struct packed_git **packs_head, int ret; if (has_pack_index(sha1)) { - new_pack = parse_pack_index(sha1, NULL); + new_pack = parse_pack_index(sha1, sha1_pack_index_name(sha1)); if (!new_pack) return -1; /* parse_pack_index() already issued error message */ goto add_pack; |