summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9b0aa72)
raw | patch | inline | side by side (parent: 9b0aa72)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 19 Apr 2010 14:23:08 +0000 (07:23 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 20 Apr 2010 00:56:17 +0000 (17:56 -0700) |
The easiest way to verify a pack index is to open it through the
standard parse_pack_index function, permitting the header check
to happen when the file is mapped. However, the dumb HTTP client
needs to verify a pack index before its moved into its proper file
name within the objects/pack directory, to prevent a corrupt index
from being made available. So permit the caller to specify the
exact path of the index file.
For now we're still using the final destination name within the
sole call site in http.c, but eventually we will start to parse
the temporary path instead.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
standard parse_pack_index function, permitting the header check
to happen when the file is mapped. However, the dumb HTTP client
needs to verify a pack index before its moved into its proper file
name within the objects/pack directory, to prevent a corrupt index
from being made available. So permit the caller to specify the
exact path of the index file.
For now we're still using the final destination name within the
sole call site in http.c, but eventually we will start to parse
the temporary path instead.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
http.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
index 0eba039dbfe581d057212efe6a21702fa736a980..7db23eff26a7f42d2a92f8f7023e22bad3f4e661 100644 (file)
--- a/cache.h
+++ b/cache.h
extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match, unsigned int flags, struct extra_have_objects *);
extern int server_supports(const char *feature);
-extern struct packed_git *parse_pack_index(unsigned char *sha1);
+extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);
extern void prepare_packed_git(void);
extern void reprepare_packed_git(void);
index 95e3b8bec87ea5caba7d0b293eb7c34184c86f7a..9c626322022c50d0c4c123e1e017a3797b28a9e8 100644 (file)
--- a/http.c
+++ b/http.c
if (fetch_pack_index(sha1, base_url))
return -1;
- new_pack = parse_pack_index(sha1);
+ new_pack = parse_pack_index(sha1, sha1_pack_index_name(sha1));
if (!new_pack)
return -1; /* parse_pack_index() already issued error message */
new_pack->next = *packs_head;
diff --git a/sha1_file.c b/sha1_file.c
index 4e82654d7c1636f22854f50219ee97bc4027c144..9f3f514e713cf7d1e2efdbe5de093671cc6b8fdf 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
return p;
}
-struct packed_git *parse_pack_index(unsigned char *sha1)
+struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path)
{
- const char *idx_path = sha1_pack_index_name(sha1);
const char *path = sha1_pack_name(sha1);
struct packed_git *p = alloc_packed_git(strlen(path) + 1);