]>
Commit | Line | Data |
---|---|---|
1 | #ifndef REMOTE_H | |
2 | #define REMOTE_H | |
3 | ||
4 | struct remote { | |
5 | const char *name; | |
6 | ||
7 | const char **url; | |
8 | int url_nr; | |
9 | ||
10 | const char **push_refspec; | |
11 | struct refspec *push; | |
12 | int push_refspec_nr; | |
13 | ||
14 | const char **fetch_refspec; | |
15 | struct refspec *fetch; | |
16 | int fetch_refspec_nr; | |
17 | ||
18 | /* | |
19 | * -1 to never fetch tags | |
20 | * 0 to auto-follow tags on heuristic (default) | |
21 | * 1 to always auto-follow tags | |
22 | * 2 to always fetch tags | |
23 | */ | |
24 | int fetch_tags; | |
25 | ||
26 | const char *receivepack; | |
27 | const char *uploadpack; | |
28 | }; | |
29 | ||
30 | struct remote *remote_get(const char *name); | |
31 | ||
32 | typedef int each_remote_fn(struct remote *remote, void *priv); | |
33 | int for_each_remote(each_remote_fn fn, void *priv); | |
34 | ||
35 | int remote_has_url(struct remote *remote, const char *url); | |
36 | ||
37 | struct refspec { | |
38 | unsigned force : 1; | |
39 | unsigned pattern : 1; | |
40 | ||
41 | char *src; | |
42 | char *dst; | |
43 | }; | |
44 | ||
45 | struct ref *alloc_ref(unsigned namelen); | |
46 | ||
47 | /* | |
48 | * Frees the entire list and peers of elements. | |
49 | */ | |
50 | void free_refs(struct ref *ref); | |
51 | ||
52 | struct refspec *parse_ref_spec(int nr_refspec, const char **refspec); | |
53 | ||
54 | int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail, | |
55 | int nr_refspec, char **refspec, int all); | |
56 | ||
57 | /* | |
58 | * Given a list of the remote refs and the specification of things to | |
59 | * fetch, makes a (separate) list of the refs to fetch and the local | |
60 | * refs to store into. | |
61 | * | |
62 | * *tail is the pointer to the tail pointer of the list of results | |
63 | * beforehand, and will be set to the tail pointer of the list of | |
64 | * results afterward. | |
65 | */ | |
66 | int get_fetch_map(struct ref *remote_refs, const struct refspec *refspec, | |
67 | struct ref ***tail); | |
68 | ||
69 | struct ref *get_remote_ref(struct ref *remote_refs, const char *name); | |
70 | ||
71 | /* | |
72 | * For the given remote, reads the refspec's src and sets the other fields. | |
73 | */ | |
74 | int remote_find_tracking(struct remote *remote, struct refspec *refspec); | |
75 | ||
76 | struct branch { | |
77 | const char *name; | |
78 | const char *refname; | |
79 | ||
80 | const char *remote_name; | |
81 | struct remote *remote; | |
82 | ||
83 | const char **merge_name; | |
84 | struct refspec **merge; | |
85 | int merge_nr; | |
86 | }; | |
87 | ||
88 | struct branch *branch_get(const char *name); | |
89 | ||
90 | int branch_has_merge_config(struct branch *branch); | |
91 | int branch_merge_matches(struct branch *, int n, const char *); | |
92 | ||
93 | #endif |