blob: edc45ab0f5fdcd8c4145aa1c81eb3346f2eeeda9 [file] [log] [blame]
Christian Couder48de3152019-06-25 15:40:27 +02001#ifndef PROMISOR_REMOTE_H
2#define PROMISOR_REMOTE_H
3
Denton Liub06fdea2019-09-25 01:20:56 -07004#include "repository.h"
5
Christian Couder9e27bea2019-06-25 15:40:28 +02006struct object_id;
7
Christian Couder48de3152019-06-25 15:40:27 +02008/*
9 * Promisor remote linked list
Christian Couderfa3d1b62019-06-25 15:40:32 +020010 *
11 * Information in its fields come from remote.XXX config entries or
Jonathan Tan625e7f12020-09-21 20:03:56 -070012 * from extensions.partialclone.
Christian Couder48de3152019-06-25 15:40:27 +020013 */
14struct promisor_remote {
15 struct promisor_remote *next;
Christian Couderfa3d1b62019-06-25 15:40:32 +020016 const char *partial_clone_filter;
Christian Couder48de3152019-06-25 15:40:27 +020017 const char name[FLEX_ARRAY];
18};
19
Jonathan Tanef7dc2e2021-06-17 10:13:23 -070020void repo_promisor_remote_reinit(struct repository *r);
21static inline void promisor_remote_reinit(void)
22{
23 repo_promisor_remote_reinit(the_repository);
24}
25
26void promisor_remote_clear(struct promisor_remote_config *config);
27
28struct promisor_remote *repo_promisor_remote_find(struct repository *r, const char *remote_name);
29static inline struct promisor_remote *promisor_remote_find(const char *remote_name)
30{
31 return repo_promisor_remote_find(the_repository, remote_name);
32}
33
34int repo_has_promisor_remote(struct repository *r);
35static inline int has_promisor_remote(void)
36{
37 return repo_has_promisor_remote(the_repository);
38}
Jonathan Tandb7ed742020-04-02 12:19:16 -070039
40/*
41 * Fetches all requested objects from all promisor remotes, trying them one at
42 * a time until all objects are fetched. Returns 0 upon success, and non-zero
43 * otherwise.
44 *
45 * If oid_nr is 0, this function returns 0 (success) immediately.
46 */
Denton Liu8464f942019-09-20 17:03:48 -070047int promisor_remote_get_direct(struct repository *repo,
48 const struct object_id *oids,
49 int oid_nr);
Christian Couder48de3152019-06-25 15:40:27 +020050
Christian Couder48de3152019-06-25 15:40:27 +020051#endif /* PROMISOR_REMOTE_H */