]> git.ipfire.org Git - thirdparty/git.git/blame - remote.h
Merge master into aw/mirror-push
[thirdparty/git.git] / remote.h
CommitLineData
5751f490
DB
1#ifndef REMOTE_H
2#define REMOTE_H
3
4struct remote {
5 const char *name;
6
28b91f8a
SP
7 const char **url;
8 int url_nr;
5751f490
DB
9
10 const char **push_refspec;
6b62816c 11 struct refspec *push;
5751f490
DB
12 int push_refspec_nr;
13
5d46c9d4
DB
14 const char **fetch_refspec;
15 struct refspec *fetch;
16 int fetch_refspec_nr;
17
d71ab174
DB
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
5751f490 26 const char *receivepack;
0012ba21 27 const char *uploadpack;
5751f490
DB
28};
29
30struct remote *remote_get(const char *name);
31
b42f6927
JS
32typedef int each_remote_fn(struct remote *remote, void *priv);
33int for_each_remote(each_remote_fn fn, void *priv);
34
28b91f8a 35int remote_has_url(struct remote *remote, const char *url);
5d46c9d4 36
6b62816c
DB
37struct refspec {
38 unsigned force : 1;
39 unsigned pattern : 1;
40
b42f6927 41 char *src;
6b62816c
DB
42 char *dst;
43};
44
dfd255dd
DB
45struct ref *alloc_ref(unsigned namelen);
46
4577370e
DB
47struct ref *copy_ref_list(const struct ref *ref);
48
49int check_ref_type(const struct ref *ref, int flags);
50
dfd255dd
DB
51/*
52 * Frees the entire list and peers of elements.
53 */
54void free_refs(struct ref *ref);
55
2467a4fa
DB
56/*
57 * Removes and frees any duplicate refs in the map.
58 */
59void ref_remove_duplicates(struct ref *ref_map);
60
d71ab174
DB
61struct refspec *parse_ref_spec(int nr_refspec, const char **refspec);
62
6b62816c 63int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
4577370e 64 int nr_refspec, const char **refspec, int all);
6b62816c 65
d71ab174
DB
66/*
67 * Given a list of the remote refs and the specification of things to
68 * fetch, makes a (separate) list of the refs to fetch and the local
69 * refs to store into.
70 *
71 * *tail is the pointer to the tail pointer of the list of results
72 * beforehand, and will be set to the tail pointer of the list of
73 * results afterward.
9ad7c5ae
JH
74 *
75 * missing_ok is usually false, but when we are adding branch.$name.merge
76 * it is Ok if the branch is not at the remote anymore.
d71ab174 77 */
4577370e 78int get_fetch_map(const struct ref *remote_refs, const struct refspec *refspec,
9ad7c5ae 79 struct ref ***tail, int missing_ok);
d71ab174 80
4577370e 81struct ref *get_remote_ref(const struct ref *remote_refs, const char *name);
d71ab174 82
5d46c9d4
DB
83/*
84 * For the given remote, reads the refspec's src and sets the other fields.
85 */
86int remote_find_tracking(struct remote *remote, struct refspec *refspec);
87
cf818348
DB
88struct branch {
89 const char *name;
90 const char *refname;
91
92 const char *remote_name;
93 struct remote *remote;
94
95 const char **merge_name;
96 struct refspec **merge;
97 int merge_nr;
98};
99
100struct branch *branch_get(const char *name);
101
102int branch_has_merge_config(struct branch *branch);
85682c19 103int branch_merge_matches(struct branch *, int n, const char *);
cf818348 104
5751f490 105#endif