Merge branch 'jk/prune-with-bitmap-fix'
[git] / fetch-pack.h
1 #ifndef FETCH_PACK_H
2 #define FETCH_PACK_H
3
4 #include "string-list.h"
5 #include "run-command.h"
6 #include "protocol.h"
7 #include "list-objects-filter-options.h"
8
9 struct oid_array;
10
11 struct fetch_pack_args {
12         const char *uploadpack;
13         int unpacklimit;
14         int depth;
15         const char *deepen_since;
16         const struct string_list *deepen_not;
17         struct list_objects_filter_options filter_options;
18         const struct string_list *server_options;
19
20         /*
21          * If not NULL, during packfile negotiation, fetch-pack will send "have"
22          * lines only with these tips and their ancestors.
23          */
24         const struct oid_array *negotiation_tips;
25
26         unsigned deepen_relative:1;
27         unsigned quiet:1;
28         unsigned keep_pack:1;
29         unsigned lock_pack:1;
30         unsigned use_thin_pack:1;
31         unsigned fetch_all:1;
32         unsigned stdin_refs:1;
33         unsigned diag_url:1;
34         unsigned verbose:1;
35         unsigned no_progress:1;
36         unsigned include_tag:1;
37         unsigned stateless_rpc:1;
38         unsigned check_self_contained_and_connected:1;
39         unsigned self_contained_and_connected:1;
40         unsigned cloning:1;
41         unsigned update_shallow:1;
42         unsigned reject_shallow_remote:1;
43         unsigned deepen:1;
44
45         /*
46          * Indicate that the remote of this request is a promisor remote. The
47          * pack received does not need all referred-to objects to be present in
48          * the local object store, and fetch-pack will store the pack received
49          * together with a ".promisor" file indicating that the aforementioned
50          * pack is a promisor pack.
51          */
52         unsigned from_promisor:1;
53
54         /*
55          * Because fetch_pack() overwrites the shallow file upon a
56          * successful deepening non-clone fetch, if this struct
57          * specifies such a fetch, fetch_pack() needs to perform a
58          * connectivity check before deciding if a fetch is successful
59          * (and overwriting the shallow file). fetch_pack() sets this
60          * field to 1 if such a connectivity check was performed.
61          *
62          * This is different from check_self_contained_and_connected
63          * in that the former allows existing objects in the
64          * repository to satisfy connectivity needs, whereas the
65          * latter doesn't.
66          */
67         unsigned connectivity_checked:1;
68 };
69
70 /*
71  * sought represents remote references that should be updated from.
72  * On return, the names that were found on the remote will have been
73  * marked as such.
74  */
75 struct ref *fetch_pack(struct fetch_pack_args *args,
76                        int fd[],
77                        const struct ref *ref,
78                        struct ref **sought,
79                        int nr_sought,
80                        struct oid_array *shallow,
81                        struct string_list *pack_lockfiles,
82                        enum protocol_version version);
83
84 /*
85  * Print an appropriate error message for each sought ref that wasn't
86  * matched.  Return 0 if all sought refs were matched, otherwise 1.
87  */
88 int report_unmatched_refs(struct ref **sought, int nr_sought);
89
90 #endif