summaryrefslogtreecommitdiff
path: root/http.h
diff options
context:
space:
mode:
authorTay Ray Chuan <rctay89@gmail.com>2009-06-06 16:44:01 +0800
committerJunio C Hamano <gitster@pobox.com>2009-06-06 11:03:11 -0700
commit2264dfa5c4f11e2b0e2740072208186bee361afd (patch)
tree40022b4b80e2af8b0659e85b821a2208847c7670 /http.h
parent39dc52cf4ff04e9cd4d2562218ad619e23a81efa (diff)
downloadgit-2264dfa5c4f11e2b0e2740072208186bee361afd.tar.gz
http*: add helper methods for fetching packs
The code handling the fetching of packs in http-push.c and http-walker.c have been refactored into new methods and a new struct (http_pack_request) in http.c. They are not meant to be invoked elsewhere. The new methods in http.c are - new_http_pack_request - finish_http_pack_request - release_http_pack_request and the new struct is http_pack_request. Add a function, new_http_pack_request(), that deals with the details of coming up with the filename to store the retrieved packfile, resuming a previously aborted request, and making a new curl request. Update http-push.c::start_fetch_packed() and http-walker.c::fetch_pack() to use this. Add a function, finish_http_pack_request(), that deals with renaming the pack, advancing the pack list, and installing the pack. Update http-push.c::finish_request() and http-walker.c::fetch_pack to use this. Update release_request() in http-push.c and http-walker.c to invoke release_http_pack_request() to clean up pack request helper data. The local_stream member of the transfer_request struct in http-push.c has been removed, as the packfile pointer will be managed in the struct http_pack_request. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.h')
-rw-r--r--http.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/http.h b/http.h
index 180b1c2ae2..511c0c4417 100644
--- a/http.h
+++ b/http.h
@@ -150,4 +150,21 @@ extern int http_fetch_ref(const char *base, struct ref *ref);
extern int http_get_info_packs(const char *base_url,
struct packed_git **packs_head);
+struct http_pack_request
+{
+ char *url;
+ struct packed_git *target;
+ struct packed_git **lst;
+ FILE *packfile;
+ char filename[PATH_MAX];
+ char tmpfile[PATH_MAX];
+ struct curl_slist *range_header;
+ struct active_request_slot *slot;
+};
+
+extern struct http_pack_request *new_http_pack_request(
+ struct packed_git *target, const char *base_url);
+extern int finish_http_pack_request(struct http_pack_request *preq);
+extern void release_http_pack_request(struct http_pack_request *preq);
+
#endif /* HTTP_H */