Git fork
1#ifndef PROMISOR_REMOTE_H
2#define PROMISOR_REMOTE_H
3
4#include "repository.h"
5
6struct object_id;
7
8/*
9 * Promisor remote linked list
10 *
11 * Information in its fields come from remote.XXX config entries or
12 * from extensions.partialclone, except for 'accepted' which comes
13 * from protocol v2 capabilities exchange.
14 */
15struct promisor_remote {
16 struct promisor_remote *next;
17 char *partial_clone_filter;
18 unsigned int accepted : 1;
19 const char name[FLEX_ARRAY];
20};
21
22void repo_promisor_remote_reinit(struct repository *r);
23void promisor_remote_clear(struct promisor_remote_config *config);
24struct promisor_remote *repo_promisor_remote_find(struct repository *r, const char *remote_name);
25int repo_has_promisor_remote(struct repository *r);
26
27/*
28 * Fetches all requested objects from all promisor remotes, trying them one at
29 * a time until all objects are fetched.
30 *
31 * If oid_nr is 0, this function returns immediately.
32 */
33void promisor_remote_get_direct(struct repository *repo,
34 const struct object_id *oids,
35 int oid_nr);
36
37/*
38 * Prepare a "promisor-remote" advertisement by a server.
39 * Check the value of "promisor.advertise" and maybe the configured
40 * promisor remotes, if any, to prepare information to send in an
41 * advertisement.
42 * Return value is NULL if no promisor remote advertisement should be
43 * made. Otherwise it contains the names and urls of the advertised
44 * promisor remotes separated by ';'. See gitprotocol-v2(5).
45 */
46char *promisor_remote_info(struct repository *repo);
47
48/*
49 * Prepare a reply to a "promisor-remote" advertisement from a server.
50 * Check the value of "promisor.acceptfromserver" and maybe the
51 * configured promisor remotes, if any, to prepare the reply.
52 * Return value is NULL if no promisor remote from the server
53 * is accepted. Otherwise it contains the names of the accepted promisor
54 * remotes separated by ';'. See gitprotocol-v2(5).
55 */
56char *promisor_remote_reply(const char *info);
57
58/*
59 * Set the 'accepted' flag for some promisor remotes. Useful on the
60 * server side when some promisor remotes have been accepted by the
61 * client.
62 */
63void mark_promisor_remotes_as_accepted(struct repository *repo, const char *remotes);
64
65/*
66 * Has any promisor remote been accepted by the client?
67 */
68int repo_has_accepted_promisor_remote(struct repository *r);
69
70#endif /* PROMISOR_REMOTE_H */