Christian Couder | 48de315 | 2019-06-25 15:40:27 +0200 | [diff] [blame] | 1 | #ifndef PROMISOR_REMOTE_H |
| 2 | #define PROMISOR_REMOTE_H |
| 3 | |
Denton Liu | b06fdea | 2019-09-25 01:20:56 -0700 | [diff] [blame] | 4 | #include "repository.h" |
| 5 | |
Christian Couder | 9e27bea | 2019-06-25 15:40:28 +0200 | [diff] [blame] | 6 | struct object_id; |
| 7 | |
Christian Couder | 48de315 | 2019-06-25 15:40:27 +0200 | [diff] [blame] | 8 | /* |
| 9 | * Promisor remote linked list |
Christian Couder | fa3d1b6 | 2019-06-25 15:40:32 +0200 | [diff] [blame] | 10 | * |
| 11 | * Information in its fields come from remote.XXX config entries or |
Jonathan Tan | 625e7f1 | 2020-09-21 20:03:56 -0700 | [diff] [blame] | 12 | * from extensions.partialclone. |
Christian Couder | 48de315 | 2019-06-25 15:40:27 +0200 | [diff] [blame] | 13 | */ |
| 14 | struct promisor_remote { |
| 15 | struct promisor_remote *next; |
Christian Couder | fa3d1b6 | 2019-06-25 15:40:32 +0200 | [diff] [blame] | 16 | const char *partial_clone_filter; |
Christian Couder | 48de315 | 2019-06-25 15:40:27 +0200 | [diff] [blame] | 17 | const char name[FLEX_ARRAY]; |
| 18 | }; |
| 19 | |
Jonathan Tan | ef7dc2e | 2021-06-17 10:13:23 -0700 | [diff] [blame] | 20 | void repo_promisor_remote_reinit(struct repository *r); |
| 21 | static inline void promisor_remote_reinit(void) |
| 22 | { |
| 23 | repo_promisor_remote_reinit(the_repository); |
| 24 | } |
| 25 | |
| 26 | void promisor_remote_clear(struct promisor_remote_config *config); |
| 27 | |
| 28 | struct promisor_remote *repo_promisor_remote_find(struct repository *r, const char *remote_name); |
| 29 | static inline struct promisor_remote *promisor_remote_find(const char *remote_name) |
| 30 | { |
| 31 | return repo_promisor_remote_find(the_repository, remote_name); |
| 32 | } |
| 33 | |
| 34 | int repo_has_promisor_remote(struct repository *r); |
| 35 | static inline int has_promisor_remote(void) |
| 36 | { |
| 37 | return repo_has_promisor_remote(the_repository); |
| 38 | } |
Jonathan Tan | db7ed74 | 2020-04-02 12:19:16 -0700 | [diff] [blame] | 39 | |
| 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 Liu | 8464f94 | 2019-09-20 17:03:48 -0700 | [diff] [blame] | 47 | int promisor_remote_get_direct(struct repository *repo, |
| 48 | const struct object_id *oids, |
| 49 | int oid_nr); |
Christian Couder | 48de315 | 2019-06-25 15:40:27 +0200 | [diff] [blame] | 50 | |
Christian Couder | 48de315 | 2019-06-25 15:40:27 +0200 | [diff] [blame] | 51 | #endif /* PROMISOR_REMOTE_H */ |