summaryrefslogtreecommitdiff
path: root/http.h
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2020-06-10 20:57:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-06-11 01:06:34 (GMT)
commiteb05349247415992644fc63ba0cf0c4821d4eef2 (patch)
tree442f88c8b33e83eb1c38adaff66f5ee6c2ef8e43 /http.h
parent9cb3cab56063754d9ee5bb27886c616ca1aec134 (diff)
downloadgit-eb05349247415992644fc63ba0cf0c4821d4eef2.zip
git-eb05349247415992644fc63ba0cf0c4821d4eef2.tar.gz
git-eb05349247415992644fc63ba0cf0c4821d4eef2.tar.bz2
http: refactor finish_http_pack_request()
finish_http_pack_request() does multiple tasks, including some housekeeping on a struct packed_git - (1) closing its index, (2) removing it from a list, and (3) installing it. These concerns are independent of fetching a pack through HTTP: they are there only because (1) the calling code opens the pack's index before deciding to fetch it, (2) the calling code maintains a list of packfiles that can be fetched, and (3) the calling code fetches it in order to make use of its objects in the same process. In preparation for a subsequent commit, which adds a feature that does not need any of this housekeeping, remove (1), (2), and (3) from finish_http_pack_request(). (2) and (3) are now done by a helper function, and (1) is the responsibility of the caller (in this patch, done closer to the point where the pack index is opened). Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.h')
-rw-r--r--http.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/http.h b/http.h
index 5e0ad72..bbc6b07 100644
--- a/http.h
+++ b/http.h
@@ -216,18 +216,25 @@ int http_get_info_packs(const char *base_url,
struct http_pack_request {
char *url;
- struct packed_git *target;
- struct packed_git **lst;
FILE *packfile;
struct strbuf tmpfile;
struct active_request_slot *slot;
};
struct http_pack_request *new_http_pack_request(
- struct packed_git *target, const char *base_url);
+ const unsigned char *packed_git_hash, const char *base_url);
int finish_http_pack_request(struct http_pack_request *preq);
void release_http_pack_request(struct http_pack_request *preq);
+/*
+ * Remove p from the given list, and invoke install_packed_git() on it.
+ *
+ * This is a convenience function for users that have obtained a list of packs
+ * from http_get_info_packs() and have chosen a specific pack to fetch.
+ */
+void http_install_packfile(struct packed_git *p,
+ struct packed_git **list_to_remove_from);
+
/* Helpers for fetching object */
struct http_object_request {
char *url;